This project is read-only.

Page Break Adds New Line?

Nov 3, 2011 at 11:44 PM

Hi,

I'm using:

$section->addPageBreak();

to add a new page, but it appears it adds a new line at the beginning of the new page.

Is there any way to remove it, or am I doing anything wrong?

I didn't see any options in PHPWord_Docs_0.6.2.docx.

Thanks!

Dec 25, 2011 at 3:51 PM
Edited Dec 25, 2011 at 3:53 PM

First of all, congrats to the author of phpword. Excellent work!

I use this library in an recent project, have changed it to suit my needs and addressed many issues. More when and if asked...

 

Now, for the new line after page break:

Change the settings.xml file to the corresponding file in a plain docx you created from Word 2007/2010 in your pc. Most important, set compat tag empty.

Nov 18, 2013 at 4:33 PM
Thanks for this !

I just delete all data in the settings.xml file's compat section and it works !
(directory to the settings.xml file : _PHPWord/staticDocParts/settings.xml )
Mar 15, 2014 at 7:30 AM
it would be great to know what we are deleting. It worked, I had same problem, but all those options, what are they? Maybe we broke something what we don't see right now?
    <w:compat>
        <w:useNormalStyleForList/>
        <w:doNotUseIndentAsNumberingTabStop/>
        <w:useAltKinsokuLineBreakRules/>
        <w:allowSpaceOfSameStyleInTable/>
        <w:doNotSuppressIndentation/>
        <w:doNotAutofitConstrainedTables/>
        <w:autofitToFirstFixedWidthCell/>
        <w:underlineTabInNumList/>
        <w:displayHangulFixedWidth/>
        <w:splitPgBreakAndParaMark/>
        <w:doNotVertAlignCellWithSp/>
        <w:doNotBreakConstrainedForcedTable/>
        <w:doNotVertAlignInTxbx/>
        <w:useAnsiKerningPairs/>
        <w:cachedColBalance/>
    </w:compat>
Mar 20, 2014 at 5:55 AM
Bug confirmed. I've submitted a bug report for this in GitHub. Thanks.
May 18, 2014 at 4:51 PM
This bug was fixed. Please read the detail in GitHub. Thanks.