Forum


Replies: 1   Views: 81
How to align text to left and right both at a time

Posted by fairshareitservices  · 30-09-2024 - 07:17

I have a string that I can divide into two strings based on <align>. Then after that, for the first string I have to align at the left, and for the second string I have to align at the right of a table cell. How can I achieve this for code below
 

 $docx = new CreateDocx();

    $wf = new WordFragment($docx);

    $text = array();

    $inputExploded=explode('<align>',$inputText);

Posted by admin  · 30-09-2024 - 08:47

Hello,

DOCX documents can apply a text alignment to the whole paragraph (https://support.microsoft.com/en-us/office/align-text-left-or-right-center-text-or-justify-text-on-a-page-70da744d-0f4d-472e-916d-1c42d94dc33f). A DOCX doesn't support applying distinct text alignments in the same paragraph.

addText (https://www.phpdocx.com/api-documentation/word-content/add-paragraph-text-Word-document-with-PHP) includes the textAlign option to set the text alignment.

Regards.