目前,我正在努力在phpword文本框内对齐。
我不能执行左对齐、右对齐和居中对齐。
$textbox =
$section->addTextBox(
array(
'alignment' => \PhpOffice\PhpWord\SimpleType\Jc::CENTER,
'width' => 460,
'height' => 100,
'borderSize' => 1,
'borderColor' => '000',
)
);
$textbox->addText("Form No. SH-1", array('align'=>'center'));
$textbox->addText('SHARE CERTIFICATE.', $fontStyle2);
$cell = $textbox->addTable()->addRow()->addCell();
$cell->addText('Pursuant to sub-section 3 of section 46 of the Companies Act, 2013 and rule 5-2 of the Companies Share Capital and Debenture Rules, 2014', $fontStyle2);如果有人知道,我需要将上面的文本放在中间,请让我知道
发布于 2018-04-23 01:29:16
addText函数的第二个参数是字体样式,第三个参数是对齐规则所属的段落样式。因此,您只需将对齐规则作为第三个参数正确传递即可:
$textbox->addText("Form No. SH-1", null, array('align'=>'center'));发布于 2019-07-11 05:05:26
$phpWord->addParagraphStyle('Paragraph', array('bold' => true , 'align' => 'center' ));$textbox->addText('Hello World' , null, 'Paragraph' );发布于 2021-09-28 13:46:41
使用样式进行对齐:
$section->addText('Hello Stackoverflow!', [], [ 'align' => \PhpOffice\PhpWord\Style\Alignment::ALIGN_CENTER ]);https://stackoverflow.com/questions/49914479
复制相似问题