Forum


Replies: 4   Views: 3039
Can i remove all content types using deletetemplateblock in basic version or just simple text?
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 jrhilldev  · 14-12-2016 - 10:46

Hello,

I am building a docx builder feature for a php application I have been working on. We are thinking about purchasing the Basic version which includes the deleteTemplateBlock feature. My question is, can you delete any kind of content as long it is wrapped in the $BLOCK_varName$ template tags or only simple text blocks? I am trying to produce a docx file where the inclusion of content is controlled purely by $BLOCK_varName$ tags and I would need to be able to delete (or leave) graphs, charts, tables and ither types of content. The reason I ask is because I tried other PHP libraries which offers similar functionality but where it is only possible to delete simple text blocks. The deleteTemplateBlock method is not included in the evaluation version so I am unable to test. We will probably go ahead and purchase the Basic version but we will need to know this first. Also does it remove the $BLOCK_varName$ tags on blocks which are left in the doc. Silly question I know but I have tested libraries which don't do this or at leat they try to di it but they do it very badly using regex. Any help appreciated.

 

Thanks

Posted by admin  · 14-12-2016 - 10:56

Hello,

The method deleteTemplateBlock removes all contents wrapped by the block placeholders: images, paragraphs, tables, charts, shapes...

If you need a more powerful tool, we recommend you using DOCXPath (only available in Advanced and Premium licenses):

http://www.phpdocx.com/documentation/introduction/docxpath

Regards.

Posted by jrhilldev  · 16-12-2016 - 10:26

OK so I have purchased the Basic version, deleted some blocks using the $BLOCK_varName$ method but now the $BLOCK_varName$ tags are left around the optional content which is not removed. How can we remove these tags around remaining content? I alluded to it in my first post before I bought the basic version.

 

thanks

Posted by jrhilldev  · 16-12-2016 - 10:30

found it. was just about to delete my last post :)