Replies: 2   Views: 2035
Createdocxfromtemplate and start from top of document
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 kobbe  · 02-04-2019 - 12:05

We are using CreateDocxFromTemplate with an empty docx file. We then add content on it with embedHTML. We have noticed that before first content we add it creates an empty row of text. How do I get rid of this first empty text line?

Posted by admin  · 02-04-2019 - 13:53


No extra content is added when using an empty template and phpdocx methods (unless you add it explicitly). We think your issue is the following: MS Word always adds an empty paragraph when an empty document is created; so if you use it as a template, the new content is added after the empty paragraph.

You can remove that empty paragraph using removeWordContent from DOCXPath. You can remove the paragraph and generate a new template without it (faster solution), or remove the paragraph each time you use it (slower solution).


Posted by kobbe  · 03-04-2019 - 06:53

Thank you, worked great! :)