Forum


Replies: 6   Views: 4423
Add image as first element in template
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 tonioseiler  · 23-07-2014 - 15:32

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

Posted by admin  · 24-07-2014 - 11:57

Hello, Please send the docx to contact@phpdocx.com Regards.

Posted by tonioseiler  · 29-07-2014 - 13:49

I sent you the docs yesterday, but no response so far.

Posted by tonioseiler  · 30-07-2014 - 09:59

Hello echo? Anything new?

Posted by admin  · 30-07-2014 - 13:17

Hello, We're checking the documents; we'll answer you by email. Regards.

Posted by admin  · 08-08-2014 - 11:17

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.

Posted by tonioseiler  · 20-10-2014 - 12:33

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.