5
我有一個奇怪的問題,使用Open XML生成.docx。我有一個TableCell
具有Paragraph
然後Run
那麼產生這樣Text
:打開XML段落間距
tblRow.Append(new TableCell(new Paragraph(GetPropertiesForStyle("TableDescription"), new Run(new Text(colName)))));
的GetPropertiesForStyle
方法返回ParagraphProperties
的特定段落,並設置樣式。這一切都可以正常工作,但是在表格行中,第一個單元格在之前似乎具有雙倍間距,而最後一個單元格之後具有雙倍間距 - 中間的所有單元格都非常精細。
我的風格的配置是這樣的:
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>
任何想法是怎麼回事?