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


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?



$docx = new CreateDocx();

$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]]]);


Sample output of the same document:

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


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


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


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