Hi. I want to find text: “3” and remove the column where I found this text. How to do that? Thanks
Hi John,
Try this:
var document = DocumentModel.Load("input.docx");
var content = document.Content.Find("5").First();
var cell = (TableCell)content.Start.Parent.GetParentElements(ElementType.TableCell).First();
int index = cell.Parent.Cells.IndexOf(cell);
foreach (var row in cell.Parent.Parent.Rows)
row.Cells.RemoveAt(index);
document.Save("output.docx");
I hope it helps.
Regards,
Mario