Forum


Replies: 3   Views: 1072
Delete entire table if no data
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 rstoeber  · 07-12-2021 - 18:04

Thank you! That worked perfectly on my first try!!!

If there is no data for the table, I simply created one row of fake data containing recognizable text, then placed that into the table with replaceTableVariable(). After that I deleted the table following the example like this:

  $referenceNode = array(
    'type' => 'table',
    'contains' => 'DeleteDelete',
  );
  $docx->removeWordContent($referenceNode);

 

The user is making the template so I don't know anything about it unless I insert my own content. Does this sound like a good approach, or is there an easier way?

I think your reply stopped one or two words short. You said "deleteTemplateBlock is designed to work with ." 

What is that designed to work with?