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  · 26-07-2024 - 10:23

Hello,

Please check the samples included in the package, that illustrate how to use all methods available in phpdocx. You need to use the addText method with the styles you want to apply.

For example, to add an empty paragraph with custom spacing, font family, and font size styles:

$docx->addText('Content 1', array('spacingBottom' => 0));
$docx->addText('', array('fontSize' => 6, 'font' => 'Arial', 'spacingBottom' => 4, 'spacingTop' => 4));
$docx->addText('Content 2');

Or to add a specific text style before a soft break:

$breakFragment = new WordFragment($docx);
$breakFragment->addBreak();

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

$docx->addText($runs);

Regards.