【问题标题】:page break not working in phpdocx library分页符在 phpdocx 库中不起作用
【发布时间】:2023-03-08 11:50:01
【问题描述】:

我正在使用 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';

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

【问题讨论】:

    标签: phpdocx


    【解决方案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');
    

    【讨论】:

    • 我有分页问题,​​而不是换行问题。确实,换行工作完美。
    • 对不起,我的错误,也许这可以帮助你:)
    猜你喜欢
    • 1970-01-01
    • 2013-01-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-03-04
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多