Hi Ashish,
Thanks for your inquiry. You can achieve your requirement by implementing
IReplacingCallback interface.
Please use the same approach shared at following documentation link to
find text and remove the table's row. See the highlighted code snippet
below.
Please read the following article about 'Find and Replace' and check the following code example for your kind reference.
Hope this helps you. Please let us know if you have any more queries.
private class FindandRemoveRow
: IReplacingCallback
{
///
/// NOTE: This is a simplistic method that will only work well
when the match
/// starts at the beginning of a run.
///
ReplaceAction
IReplacingCallback.Replacing(ReplacingArgs e)
{
if
(e.MatchNode.GetAncestor(NodeType.Row) != null)
{
Node
node = e.MatchNode.GetAncestor(NodeType.Row);
node.Remove();
}
e.Replacement = "";
return ReplaceAction.Replace;
}
Document doc = new Document(MyDir + "in.docx");
doc.Range.Replace(new Regex("Remove"), new
FindandRemoveRow(), false);
doc.Save(MyDir
+ "Out.docx");