Search code examples
phpxmlphpwordodt

Setting indent for paragraph in .odt using phpword


I'm trying to generate .odt files in php using phpword. But some of the features are not working for .odt files, which are working for .doc files.

I'm trying to add indent for a paragraph and justification also. But that part is not implemented for .odt files. I'm trying to do it myself, but still struggling with it.

Pagination for paragraph is shown in their sample code, but not working for .odt files.https://github.com/PHPOffice/PHPWord/blob/develop/samples/Sample_08_ParagraphPagination.php

Does anyone has a clue for implementing this?


Solution

  • I've temporarily fixed it by adding justification and indent tags in paragraph properties for ODText.

    $xmlWriter->writeAttribute('fo:text-align',"justify"); 
    $xmlWriter->writeAttribute('fo:margin-left', '1.249cm');