Forum


Replies: 2   Views: 861
Style for paragraph in table not properly applied in libreoffice
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by dan_brokerbusiness  · 11-09-2020 - 05:25

Hi

For demo purposes I have defined a paragraph style 'Example' with 3x line spacing and a large 50pt spacing before and after. If a text with this style is added to the main document everything works as expected. If it is added into a table cell the resulting docx works as expected in MS Office but in Libreoffice only the top spacing is applied, the bottom spacing and line spacing is ignored.

Strangely I can see in the styles panel that the 'Example' style is properly applied and if I re-apply the same style it gets fixed in libreoffice too. As we only need libreoffice for PDF output that doesn't help though.

Is there any way to fix this so libreoffice applies the full style definition of a paragraph in a cell right away?

Regards

Code

$docx = new CreateDocx();
$docx->importStyles(resource_path('word/example.docx'));

$docx->addText(str_repeat('Lorem Ipsum ', 20), ['pStyle' => 'Example']);

$p1 = new WordFragment($docx);
$p1->addText(str_repeat('Lorem Ipsum ', 20), ['pStyle' => 'Example']);

$docx->addTable([[['value' => $p1]]]);

$docx->createDocx('Output');

Sample output of the same document: 
https://ibb.co/Y8kDpmr

Posted by admin  · 11-09-2020 - 06:14

Hello,

Please send the DOCX you are importing (example.docx) to contact[at]phpdocx.com, so we can test the code with the same document you are using.

Regards.

Posted by admin  · 11-09-2020 - 11:27

Hello,

After checking the document and the script, we found that there's no issue when using the latest version of LibreOffice (7). We recommend using the latest release available on http://www.libreoffice.org.

Regards.