private static void ReplaceWordRun(OXD.Paragraph paragraph, OXD.Run initRun, OXD.Run finalRun) { if (null != paragraph.Descendants<OXD.Run>()) { List<OXD.Run> runs = paragraph.Descendants<OXD.Run>().ToList(); foreach (var run in runs) { if (initRun != run) { paragraph.RemoveChild<OXD.Run>(run); } } paragraph.ReplaceChild<OXD.Run>(finalRun, initRun); } }
private static void ModifyPowerPointCellTextContent(OXD.TableCell cell, string txt) { if (null != cell) { OXD.TextBody textbody = cell.Descendants<OXD.TextBody>().FirstOrDefault(); if (null != textbody) { OXD.TextBody final_textbody = textbody.CloneNode(true) as OXD.TextBody; OXD.Paragraph paragraph = final_textbody.Descendants<OXD.Paragraph>().FirstOrDefault(); if (null != paragraph) { OXD.Paragraph final_paragraph = paragraph.CloneNode(true) as OXD.Paragraph; ModifyPowerPointParagraphTextContent(final_paragraph, txt); final_textbody.ReplaceChild<OXD.Paragraph>(final_paragraph, paragraph); } cell.ReplaceChild<OXD.TextBody>(final_textbody, textbody); } } }