Skip to content

Missing TableBorders within TableProperties when parsing Word docx #1907

@maestro957

Description

@maestro957

Describe the bug
When opening a Word document using the Open-XML-SDK, the TableBorders element within the TableProperties (<w:tblPr>) is missing from the parsed document structure.

Screenshots
If applicable, add screenshots to help explain your problem.

To Reproduce

  1. Create a Word document (.docx) with a table that includes TableBorders defined within the TableProperties.
  2. Open the document using the Open-XML-SDK with the following code:
using (WordprocessingDocument wordDoc = WordprocessingDocument.Open(stream, false))
{
        Body body = wordDoc.MainDocumentPart.Document.Body;
        Console.WriteLine(body.OuterXml);
}
  1. Inspect the OuterXml of the Body element.

Observed behavior
The TableBorders element is missing from the TableProperties in the parsed document structure. The TableProperties appear as follows:

<w:tblPr>
    <w:tblStyle w:val="TableGrid"/>
    <w:tblW w:w="0" w:type="auto"/>
    <w:tblLook w:val="04A0" w:firstRow="1" w:lastRow="0" w:firstColumn="1" w:lastColumn="0" w:noHBand="0" w:noVBand="1"/>
</w:tblPr>

Expected behavior
The TableBorders element should be present within the TableProperties (<w:tblPr>) in the parsed document structure.

Document Example

<w:tblPr>
    <w:tblStyle w:val="TableGrid"/>
    <w:tblW w:w="0" w:type="auto"/>
    <w:tblBorders>
        <w:top w:val="thinThickThinSmallGap" w:sz="24" w:space="0" w:color="auto"/>
        <w:left w:val="thinThickThinSmallGap" w:sz="24" w:space="0" w:color="auto"/>
        <w:bottom w:val="thinThickThinSmallGap" w:sz="24" w:space="0" w:color="auto"/>
        <w:right w:val="thinThickThinSmallGap" w:sz="24" w:space="0" w:color="auto"/>
        <w:insideH w:val="thinThickThinSmallGap" w:sz="24" w:space="0" w:color="auto"/>
        <w:insideV w:val="thinThickThinSmallGap" w:sz="24" w:space="0" w:color="auto"/>
    </w:tblBorders>
    <w:tblLook w:val="04A0" w:firstRow="1" w:lastRow="0" w:firstColumn="1" w:lastColumn="0" w:noHBand="0" w:noVBand="1"/>
</w:tblPr>

Desktop (please complete the following information):

  • OS: Windows 10/11
  • .NET Target: .NET Core 9
  • DocumentFormat.OpenXml Version: 3.3.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions