Hello,
The customQuery option allows using a custom XPath query (https://www.w3schools.com/xml/xpath_intro.asp). If you know a text content available in a table row you can use the contains function available in XPath, instead of setting the position. For example, using a DOCX document included in the package, you can remove the row that includes 24 running:
$referenceNode = array(
'customQuery' => '//w:tbl/w:tr[contains(.,"24")]',
);
$docx->removeWordContent($referenceNode);
You can also get DOCXPath query information using the following method: getDocxPathQueryInfo. DOCXPath and XPath includes many options to choose the contents to be changed, updated, removed, cloned, inserted...
Please note that XPath has some protected characters that you may need to escape if you want to query by a text with protected characters.
If you open a support ticket (https://www.phpdocx.com/support) attaching the DOCX you want to modify, the dev team will generate a custom code using your template.
Regards.