Forum


Replies: 10   Views: 4621
A paragraph without spacing between lines
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 lobato  · 01-11-2011 - 00:25

Hi

How do I get next paragraph (without a 10pt space between lines)?

Lorem ipsum dolor sit amet
consectetur adipisicing elit
sed do eiusmod

I wrote each line in AddText call but it always starts a new paragraph. Any way of changing this?

Regards

Posted by admin  · 11-04-2013 - 12:13

Hello,

Phpdocx pro includes 'lineSpacing' options in addText method. Please check easy/Text_linespacing.php included example.

Regards.

Posted by thetaylor82  · 11-04-2013 - 12:13

I have a problem with the linespacing!

When I simply set the following:
[code]$paramsTextTitle = array(
'b' => 'single',
'lineSpacing' => 120
);
$docx->addText("20$year1 - 20$year2", $paramsTextTitle);[/code]

It just decreases the height of the line, it does not adjust the paragraph line spacing.

[img]https://lh4.googleusercontent.com/-MIM2CC6w2mw/TrF2VuhB_JI/AAAAAAAAAEA/Mbn0x90Zrvs/s158/phpdocx-linespacing.jpg[/img]

Posted by thetaylor82  · 11-04-2013 - 12:13

Any ideas on this?

Posted by admin  · 11-04-2013 - 12:13

Hello,

We'll check it.

Regards.

Posted by bowett  · 11-04-2013 - 12:13

Is there any update on this? It seems to be a common issue.

Posted by intphpdocx  · 29-07-2013 - 17:00

An easy fix for this is to use importStyles() to load the styles from an existing Word document in which you have set the desired line spacing.



$docx = new CreateDocx();



$docx->importStyles('./default_styles.docx', 'replace');


Posted by admin-phpdocx  · 29-07-2013 - 17:42

You may control the line spacing with the lineSpacing option in the $paragraphOptions parameter.



The way Word handles it is a little bizarre: a value of 240 corresponds to single spacing and 480 to double spacing and so long so forth.



We decided to keep that notation although it could have been clearer to use a float with 1 corresponding to single spacing.


Posted by ufellc  · 06-08-2013 - 23:15

This is not a line spacing issue. Changing line spacing actually changes the height of the line.
This is a paragraph spacing issue.
There is not space between lines, there is space between paragraphs.
Open a generated document in Word, and every paragraph created by addText is formatted to add 10pt After the paragraph.
I have tried spacingBottom, but it has no effect.

Posted by ufellc  · 07-08-2013 - 23:02

In the phpdocx folder there is a folder named templates.
In the templates folder is a file named phpdocxBaseTemplate.docx
I opened this file, looked at the "Normal" style and discovered it had 10pt after paragraph and Mixed 1.15 line spacing.
When I changed this file to have 0pt after and Single line spacing, all my troubles vanished.