wordpress hit counter
Re: Insert rows Dynamically - WordprocessingML - Formats - OpenXML Developer

Re: Insert rows Dynamically

Formats

Discussions about working with different Open XML Formats

Insert rows Dynamically

  • rated by 0 users
  • This post has 2 Replies |
  • 2 Followers
  • How to  insert a row dynamically with contents defined already in template ....

    A count value from DB tables will define the no of rows to be generated...

  • You can insert rows easily enough using the following code:

                // Create a row.
                TableRow tr = new TableRow();
     
                // Create a cell.
                TableCell tc1 = new TableCell();
     
                // Specify the width property of the table cell.
                tc1.Append(new TableCellProperties(
                    new TableCellWidth() { Type = TableWidthUnitValues.Dxa, Width = "2400" }));
     
                // Specify the table cell content.
                tc1.Append(new Paragraph(new Run(new Text("some text"))));
     
                // Append the table cell to the table row.
                tr.Append(tc1);
     
                // Create a second table cell by copying the OuterXml value of the first table cell.
                TableCell tc2 = new TableCell(tc1.OuterXml);
     
                // Append the table cell to the table row.
                tr.Append(tc2);
     
                // Append the table row to the table.
                table.Append(tr);
    

     

    When you are asking about how to insert the row using contents from a template, what format is that template in and how are you reading the contents back out? Depending on your needs, you might need to iterate over the code above differently or add further logic to handle the formatting.

  • I have to read the values from the db tables and i have a xml defined template . Depending on the no of rows in the db tables i have to insert that many no of rows in xml..

    The pattern in which i will add data to the xml template is defined.

    and i also would like to know how to insert this code into xml tempalte.

Page 1 of 1 (3 items)