-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A full page of text generates a blank page break. #475
Comments
I am not one of the developers but I bet it is a paragraph node w:p automatically. Maybe? A separate function should be created to find EOL and determine if w:tr,w:t, etc...? Determine page size first and put fixes in accordingly? I haven't studied the code enough and just trying to help... |
You're right it would be necessary to determine the size to see if the blade is complete and thus allow or disallow automatic line break, but I have no idea how to fix it, there must be some function in the library that already perform this calculation because there paragraph elements which are to be forced to not cut or the property cantSplit of the tables elements. |
I know not ideal but did you try creating a single row/col invisible table and putting the content in that to see if it still causes the break? Like an additional wrapper? |
yes, it was the first thing I tried and fails, after the table a new line is also generated. At the end I leave as impossible I can not waste any more time, there are few cases in which the sheet is completed to the last line, so when a blank sheet that erased manually is generated. Thanks for the help, go looking now and then this problem if somebody finds a solution. good luck |
Yeah I hear your frustration. The only other solution I can think of would be to create a separate page with a bookmark on said pages that could be blank. Insert these macros below and then call php com to run it after document is rendered...? Sub GotoBadPage() Sub DeleteBadPage() Then in your php after render do this: You could also find another macro that searches for blank pages and deletes accordingly. I have seen them out there. You will have to save the doc as a docm which I am not sure is possible with phpword. |
thx its a posible solution |
Not working. Needs to remove the blank page generated in last. Pls share your thoughts. |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
Suppose that a sheet Word have a 10 lines of text max, if we insert the 10 lines of text using a TextRun "dynamically" should have a single sheet but as phpword inserts a line break after any element such as a TextRun then generates a second blank page.
At the end of an element TextRun sends the cursor to the next line when the cursor should be behind the last letter.
Sample code:
.......
//the text recovered from database filled an entire sheet and causes a blank second page
$tr = $section->addTextRun('pStyle');
$tr->addText(h("Tittle: "),'AB11');
$tr->addText($databaseText,null,array('spaceAfter' => 0));
$objWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'Word2007');
$objWriter->save("doc.docx");
?>
Take a look at the picture for a better understanding
![linebreakproblems](https://cloud.githubusercontent.com/assets/10745348/5944035/2087103c-a724-11e4-857e-e94b52c510eb.jpg)
You can not create a property that allows enable or disable the line break after an element TextRun?
I have to fix it because it looks ugly, ¿how i can locate the code responsible for inserting page breaks so I can make a botch?
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: