1

我正在使用 PHPDocx 库。基本上我遇到了分页问题这是我的代码

    $html_body .= 'Lorem Ipsum is simply dummy text of the printing and typesetting industry';$html_body .= 'Lorem Ipsum is simply dummy text of the printing and typesetting industry';

我只想打破页面,以便这两个段落都出现在不同的页面上。请帮帮我。谢谢

4

1 回答 1

1

如果您使用 embedHTML() 方法,则可以实现此目的的唯一方法是分离 html 代码,并在其间添加一个 use addBreak() 方法。像这样的东西:

require_once '../../../classes/CreateDocx.inc';

$docx = new CreateDocx();

$paragraph1 = '<p>Lorem Ipsum is simply dummy text of the printing and type setting industry</p>';
$paragraph2 = '</br><p>Lorem Ipsum is simply dummy text of the printing and typesetting industry</p>';

$docx->embedHTML($paragraph1);

$docx->addBreak(array('type' => 'page'));

$docx->embedHTML($paragraph2);

$docx->createDocx('example_embedHTML_1');
于 2015-03-23T07:52:59.910 回答