Forum


Replies: 1   Views: 4548
Remove blank spaces
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 cem  · 15-04-2016 - 19:38

I have the Enterprise version 5.1 and I'm using a Word template via CreateDocxFromTemplate.  I looked on the forums and didn't see anything related to this actual issue.   Is there a command or function I can use to ignore/suppress blank lines in the output doc?  

For example, I have a standard address block at the top of a template.  Let's say it's Name, Title, Address per below sample.   If there is no Title for the variable (I'm passing it a blank or empty variable), I would want to do the usual where you remove that blank line so that Address is now right underneath Name.   So that if I'm making an envelope or business letter, I wouldn't want blank lines in the greeting/address block.  Thank you for any help.

 

Name

Title

Address

Posted by admin  · 17-04-2016 - 08:12

Hello,

The current version of phpdocx only allows to remove placeholders (replacing them by empty strings) or clean a preset block using this method:

http://www.phpdocx.com/api-documentation/templates/delete-Word-template-block-content

Phpdocx 6 will add a new class to support adding, removing and replacing content dynamically in any part of the main document. For example you'll be able to remove a single or alls paragraphs that contain a full string or a placeholder.

Regards.