예제 #1
0
 private static void ModifyPowerPointParagraphTextContent(OpenXmlElement paragraph, string txt)
 {
     OXD.Run run = paragraph?.Descendants <OXD.Run>().FirstOrDefault();
     if (run == null)
     {
         return;
     }
     OXD.Run  final_run  = run.CloneNode(true) as OXD.Run;
     OXD.Text text       = final_run?.Descendants <OXD.Text>().FirstOrDefault();
     OXD.Text final_text = (null == text) ? new OXD.Text() : text.CloneNode(true) as OXD.Text;
     if (final_text != null)
     {
         final_text.Text = txt;
         final_run?.ReplaceChild(final_text, text);
     }
     ReplaceWordRun(paragraph, run, final_run);
 }
예제 #2
0
 private static void ModifyPowerPointParagraphTextContent(OXD.Paragraph paragraph, string txt)
 {
     if (null != paragraph)
     {
         OXD.Run run = paragraph.Descendants <OXD.Run>().FirstOrDefault();
         if (null != run)
         {
             OXD.Run  final_run  = run.CloneNode(true) as OXD.Run;
             OXD.Text text       = final_run.Descendants <OXD.Text>().FirstOrDefault();
             OXD.Text final_text = (null == text ? new OXD.Text() : text.CloneNode(true) as OXD.Text);
             final_text.Text = txt;
             try
             { final_run.ReplaceChild <OXD.Text>(final_text, text); }
             catch
             { throw; }
             ReplaceWordRun(paragraph, run, final_run);
         }
         else
         {
             run = new OXD.Run();
         }
     }
 }