OpenXml Table error “

elements are required before every ”

前端 未结 1 436
野的像风
野的像风 2021-01-11 17:52

I have created a Word template that I am then processing via the OpenXML SDK to replace some of the content of the document with data from a database query.

The temp

相关标签:
1条回答
  • 2021-01-11 18:49

    Sorted. The original error message could not really have been any clearer!

    The last child of a table cell must be a paragraph. Simply adding an empty paragraph after the embedded table resolved the problem...

    advisoryTable.Append(new TableRow(new TableCell(itemTable, new Paragraph())));
    

    I eventually discovered this by creating a document in Word-2010 that consisted of a table within a table and then looking at the resulting XML in the same Open XML SDK 2.0 Productivity Tool for Microsoft Office tool used above.

    0 讨论(0)
提交回复
热议问题