gpt4 book ai didi

phpword addText() 对齐对齐

转载 作者:行者123 更新时间:2023-12-02 15:17:43 48 4
gpt4 key购买 nike

当我使用addText()时,它与align=center(向左或向右)一起工作正常,但是当我尝试使用align=justify时脚本工作没有问题,但是当我尝试打开 .docx 文件时,它给出错误并且文件未打开。

如果有人知道解决方案,我们将不胜感激。

$text = "some text";
$PHPWord->addFontStyle('r2Style', array('bold'=>false, 'italic'=>false, 'size'=>12));
$PHPWord->addParagraphStyle('p2Style', array('align'=>'center', 'spaceAfter'=>100));
$section->addText($text, 'r2Style', 'p2Style');

最佳答案

尝试将 'align'=>'left' 更改为 'align'=>'both'

$text = "some text";
$PHPWord->addFontStyle('r2Style', array('bold'=>false, 'italic'=>false, 'size'=>12));
$PHPWord->addParagraphStyle('p2Style', array('align'=>'both', 'spaceAfter'=>100));
$section->addText($text, 'r2Style', 'p2Style');

关于phpword addText() 对齐对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31400241/

48 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com