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.
I create a document from template and then add an Image. In the template, ms word sets a first text line to position the cursor. When i add the Image, its always positioned after this empty line of text. How can I get rid of this empty line. My document starts with a image or table (same problem there).
Thanks
Tonio
Hello,
Please send the docx to contact@phpdocx.com
Regards.
I sent you the docs yesterday, but no response so far.
Hello echo?
Anything new?
Hello,
We're checking the documents; we'll answer you by email.
Regards.
Hello,
The solution is to remove clean the template before use it. As Words always add a paragraph and doesn't allow to remove it and phpdocx preserves the initial content, you have two options:
· Extract the content of the DOCX, edit the document.xml file, remove the unwanted paragraph manually and save it again as DOCX. A DOCX is a ZIP file, so you can do it with any ZIP app
· Add in this first paragraph a placeholder and remove it using the removeTemplateVariable method before doing anything with the library.
We'll study if it's interesting to add an option in the library to remove that unwanted first paragraph for empty templates. The included template DOCX has it removed.
Regards.
I tried the second option and ran into the following problem. When the doc is empty except the empty variable, the lib thwrows an exception. I hab to iinsert content first before removing the empty var. Then this works great.
Thanks anyway.