Forum


Replies: 9   Views: 249
How to reduce space between one line break

Posted by admin  · 30-07-2024 - 12:12

Hello,

You can add line breaks and styles when adding a 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

Regards.