Open XML line spacing

I have a weird problem with creating .docx with open XML. I have TableCellone that has Paragraph, then Run, then Textis created as follows:

tblRow.Append(new TableCell(new Paragraph(GetPropertiesForStyle("TableDescription"), new Run(new Text(colName)))));

The method GetPropertiesForStylereturns ParagraphPropertiesfor a specific paragraph and sets the style. All this works fine, however, in the table row, the first cell seems to have a double span before and the last cell has a double span after - all the cells in the middle look great.

enter image description here

My style configuration is as follows:

new Style(
    new StyleName() { Val = "TableDescription" },
    new StyleParagraphProperties(
        new ParagraphBorders(
            new BottomBorder() { Val = BorderValues.None }
        ),
        new SpacingBetweenLines() { Before = "100", After = "100", Line = "200", LineRule = LineSpacingRuleValues.Exact },
        new TableCellVerticalAlignment() { Val = TableVerticalAlignmentValues.Center }
    )
),

XML , . TableCell ( , ).

<w:tc>
    <w:p>
        <w:pPr>
            <w:pStyle w:val="TableDescription" />
        </w:pPr>
        <w:r>
            <w:t>Reporting Period</w:t>
        </w:r>
    </w:p>
</w:tc>

, ?

+5
1

, :

new ContextualSpacing() { Val = false }

, .

+5

All Articles