Forum


Replies: 1   Views: 282
How to remove specific table cell? or table row?
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 fairshareitservices  · 08-04-2024 - 11:01

We are using below code to remove a specific table on condition. But we want to remove only the cell that contain 'Regular' text. Instead of removing complete table from document need to delete specific row or cell. 

if($placeHolderName == 'tracking_error_regular')
        {
        $templateDocx->removeTableRowByTemplateVariable($placeHolderName);
        $referenceNode = array(
            'type' => 'table',
            'contains' => 'TRACKING ERROR',
        );
        $templateDocx->removeWordContent($referenceNode);
        mLog("Removed table for tracking_error_regular of $schemeCode");
        return $templateDocx;
        }