Forum


Replies: 9   Views: 331
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 - 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.