开发者

OpenXML nested tables

开发者 https://www.devze.com 2023-01-31 14:08 出处:网络
I am trying to insert a Table into a TableCell, but when I try to open it in MS Word I get a message like: \"a <p> is required before a </tc>\".

I am trying to insert a Table into a TableCell, but when I try to open it in MS Word I get a message like: "a <p> is required before a </tc>".

When I open the file in compatibility mod开发者_Go百科e the table formatting looks perfect but the table lines are missing. Inserting simple text into the cell works fine, the issue only happens when I try to insert a whole table.

Inserting the Table in the document outside the other table also works fine.


If you create a nested table structure in Word, and look at the resulting XML, you will see something like:

      <w:tc>
        <w:tcPr>
          <w:tcW w:w="4621" w:type="dxa"/>
        </w:tcPr>
        <w:tbl>..</w:tbl>
        <w:p/>
      </w:tc>

As per the message, looks like you need <w:p/> after your table, and before the closing tc tag.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号