Exemplo n.º 1
0
 private void setText(String text, wp.TableCell theCell)
 {
     wp.Text _text = theCell.Descendants<wp.Text>().First();
     _text.Text = text;
 }
Exemplo n.º 2
0
 private static void ModifyWordParagraphTextContent(OXW.Paragraph paragraph, string txt)
 {
     if (null != paragraph)
     {
         OXW.Run run = paragraph.Descendants<OXW.Run>().FirstOrDefault();
         if (null != run)
         {
             run = run.CloneNode(true) as OXW.Run;
             paragraph.RemoveAllChildren<OXW.Run>();
         }
         else
         {
             run = new OXW.Run();
         }
             OXW.Text text = run.Descendants<OXW.Text>().FirstOrDefault();
             text = (null == text ? new OXW.Text() : text.CloneNode(true) as OXW.Text);
             run.RemoveAllChildren<OXW.Text>();
             text.Text = txt;
         if (!string.IsNullOrEmpty(txt) && (char.IsWhiteSpace(txt[0]) || char.IsWhiteSpace(txt[txt.Length-1]))) {
             text.Space = SpaceProcessingModeValues.Preserve;
         }
             run.Append(text);
             paragraph.Append(run);
         }
 }
Exemplo n.º 3
0
 private static void ModifyWordRowTextContent(OXW.TableRow headerRowTemplate, string txt)
 {
     if (null != headerRowTemplate)
     {
         var cells = headerRowTemplate.Descendants<OXW.TableCell>();
         if (null != cells)
         {
             foreach (var cell in cells)
             {
                 ModifyWordCellTextContent(cell, txt);
             }
         }
     }
 }
Exemplo n.º 4
0
 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);
         }
     }
 }