private static void ModifyWordCellTextContent(OXW.TableCell cell, string txt) { if (null != cell) { OXW.Paragraph paragraph = cell.Descendants <OXW.Paragraph>().FirstOrDefault(); if (null != paragraph) { paragraph = paragraph.CloneNode(true) as OXW.Paragraph; ModifyWordParagraphTextContent(paragraph, txt); cell.RemoveAllChildren <OXW.Paragraph>(); cell.Append(paragraph); } } }
private static void ModifyWordCellTextContent(OpenXmlElement cell, string txt, string txtColor, string effect) { OXW.Paragraph paragraph = cell?.Descendants <OXW.Paragraph>().FirstOrDefault(); if (paragraph == null) { return; } paragraph = paragraph.CloneNode(true) as OXW.Paragraph; ModifyWordParagraphTextContent(paragraph, txt, txtColor, effect); cell.RemoveAllChildren <OXW.Paragraph>(); if (paragraph != null) { cell.Append(paragraph); } }