Forum


Replies: 9   Views: 336
How to reduce space between one line break
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 admin  · 30-07-2024 - 12:12

Hello,

You can add line breaks and styles when adding text content (the same approach can be used with WordFragments):

$text = "A text with styles and \nbreaks \nand more contents.";
$paragraphOptions = array(
    'bold' => true,
    'font' => 'Arial',
    'parseLineBreaks' => true,
);
$docx->addText($text, $paragraphOptions);

The sample Contents/addText/sample_6.php included in the package illustrates a similar code using parseLineBreaks and parseTabs options.

The parseLineBreaks option is available in many methods: https://www.phpdocx.com/documentation/api-documentation

HTML can also be used to add content with styles and line breaks.

Regards.