PHPOffice / PHPWord

A pure PHP library for reading and writing word processing documents
https://phpoffice.github.io/PHPWord/
Other
7.16k stars 2.68k forks source link

Missing and misaligned contents using createWriter #2574

Open sakthivel-murughaiya opened 4 months ago

sakthivel-murughaiya commented 4 months ago

Describe the Bug

Issue 1:

Read and rewrite the the original document in Word 2007 using PHPWord, text alignment missing in the document.

https://preethirait-gmail.tinytake.com/msc/OTI5MjgxNV8yMjg0NjU4Mw

Issue 2:

In PHPWord, Extract HTML content from a document, add it using addHTML, and then write it using a createWriter. However, it seems that rowspan and colspan are missing in the table.

https://preethirait-gmail.tinytake.com/msc/OTI5Mjg3OV8yMjg0NjY2Mg

Steps to Reproduce

Please provide a code sample that reproduces the issue.

issue1 :

$phpWord = \App\WordPhp\PhpWord\IOFactory::load($templateFile); $objWriter = \App\WordPhp\PhpWord\IOFactory::createWriter($phpWord , 'Word2007'); $objWriter->save($path);

issue2 :

\App\WordPhp\PhpWord\Shared\Html::addHtml($section, $bodyContent, false, true); $objWriter = \App\WordPhp\PhpWord\IOFactory::createWriter($pw, 'Word2007'); $objWriter->save($path);

Expected Behavior

While extracting content from the document(.docx) and inserting the header and footer sections, it does not disrupt the content or alignments.

Current Behavior

While extracting content from the document(.docx) and inserting the header and footer sections, it disrupts the alignment and content.

Context

Please fill in your environment information: