1
Vote

Insert a table into a table's cell

description

I'm trying to insert a table into a table cell:
// create an hidden table where put the logo and the request id
    var topTable = document.AddTable(1, 2);
    topTable.Design = TableDesign.TableNormal;
    topTable.AutoFit = AutoFit.Window;


    // get the logo from the resources and put it on the first cell
    var logo = document.AddImage(GetLogoStream()).CreatePicture();
    topTable.Rows[0].Cells[0].Paragraphs[0].InsertPicture(logo);


    // create a table with the request id because I need to see the border
    var counterTable = document.AddTable(1, 1);
    counterTable.Rows[0].Cells[0].Paragraphs.First().Append("Document N° {0}".ToFormat(request.Id));

    topTable.Rows[0].Cells[1].InsertTable(counterTable);

    // insert the header table
    document.InsertTable(topTable).Alignment = Alignment.right;
The table inserted in the xml is:
<w:p><w:pPr /><w:r><w:t>Document N° 24</w:t></w:r></w:p>
It seems that it insert this tag <w:pPr /> not correctly. Or Am I using the wrong way to do that?

comments