How to know in my table cell is empty or not in aspose words c#
I want to replace the empty cell to em (—) in the table kindly help me asap.
Please find the below attachment.
Expeceted_output_table1.docx (12.7 KB)
Input_Table123.docx (14.7 KB)
@Princeshivananjappa You can use code like the following to achieve this:
Document doc = new Document(@"C:\Temp\in.docx");
List<Cell> emptyCells = doc.GetChildNodes(NodeType.Cell, true)
.Cast<Cell>().Where(c => string.IsNullOrEmpty(c.ToString(SaveFormat.Text).Trim())).ToList();
foreach (Cell c in emptyCells)
c.FirstParagraph.AppendChild(new Run(doc, "—"));
doc.Save(@"C:\Temp\out.docx");