Skip to content

Merge multiple docx files #364

Open
Open
@jp-morvan

Description

@jp-morvan

Hi,
I'm trying to merge multiple docx files by adding page break in section but the file is always empty.

$document = new \PhpOffice\PhpWord\PhpWord();
$final_document = \PhpOffice\PhpWord\IOFactory::createWriter($document, 'Word2007');
$section = $document->createSection(($i=0));
foreach($files as $file)
{
      $_document = $document->loadTemplate($file);
      $section->addPageBreak();
}
$final_document->save($filename);

Thank you


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions