require_once 'PHPWord.php';
$PHPWord = new PHPWord();
//默认页面
$section = $PHPWord->createSection(array('borderColor'=>'00FF00','borderSize'=>12));
$section->addText('This is the default section');
//新页面
$section = $PHPWord->createSection(array('orientation'=>'landscape'));
$section->addText('This is placed on a landscape section,Every page starting from this section will be landscape style');
$section->addPageBreak();
$section->addPageBreak();
//New portrait section
$section = $PHPWord->createSection(array('marginLeft'=>600,'marginTop'=>600,'marginBottom'=>600));
$section->addText('This is section users other margins');
//保存文件
$objWriter = PHPWord_IOFactory::createWriter($PHPWord,'Word2007');
$objWriter->save('Section.docx');【PHPWord】页面Section
最新推荐文章于 2023-06-01 18:08:08 发布
本文通过示例代码展示了如何使用PHPWord库创建不同样式的文档部分,包括默认页面、横向页面及自定义边距的页面,并介绍了如何在PHPWord中添加文本和页断。
6766

被折叠的 条评论
为什么被折叠?



