Forum


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

Posted by admin  · 30-07-2024 - 10:14

Hello,

You can also set the styles before and after the break:

$runs = array();
$runs[] = array('text' => 'Content 1');
$runs[] = array('text' => ' ', 'fontSize' => 6, 'font' => 'Arial');
$runs[] = $breakFragment;
$runs[] = array('text' => ' ', 'fontSize' => 6, 'font' => 'Arial');
$runs[] = array('text' => 'Content 2');

$docx->addText($runs);

Also please note as explained in a previous reply:

You can add a text (for example an empty text) with the font family and size you want to apply immediately before adding the soft break.

Please note that MS Word ignores this specific case in most cases

You can check the same if you generate the DOCX manually using MS Word. MS Word includes some default behaviors that can't be changed.

There's no other approach than the detailed ones from our previous reply to handle break styles and spacings.

Regards.