Hi,
We are trying to Delete table rows by using tags(Keyword) which is present in the Table cell. We tried below code and it is working, we need to add some condition with this code,
Document doc = new Document(_dataDir + "SampleDocWithTableAndPara.docx");
Regex regex = new Regex("<REMOVE_ROW>", RegexOptions.IgnoreCase);
FindReplaceOptions options = new FindReplaceOptions
{
Direction = FindReplaceDirection.Backward,
ReplacingCallback = new ReplaceEvaluatorFindAndDeleteRow()
};
doc.Range.Replace(regex, "", options);
Case 1: If tag(Keyword) is present in the Table, We should delete the row If all cells in the row are empty, otherwise we should not delete the the row, just delete the tag.
Case 2 : If tag(Keyword) is present in the Paragraph,
a) Delete the line / row, if line / row is empty,
b) Just delete the tag if line / row is not empty,
Please help me for find the proper solution for above cases.
Here attached the sample console application and sample input / output and expected output for your reference.
DeleteTableRowByTag.zip (5.7 MB)
Thanks and Regards,
Syed.