Aspose.Word - 如何利用完整的 table 单元格宽度?

Aspose.Word - How to make use of full table cell width?

我在 word 文档中有一个 table,我想使用完整的单元格宽度来插入数据。

默认行为是它会留下 spaces(填充),如下所示。

如何在不留下任何内容的情况下利用列的总宽度space?

您可以使用 Aspose.Words 调整单元格内容左侧、右侧、下方或上方的 space 量(以磅为单位)。请尝试使用以下代码:

Document doc = new Document(MyDir + @"input.docx");

Table tab = doc.FirstSection.Body.Tables[0];

tab.BottomPadding = 0;
tab.LeftPadding = 0;
tab.RightPadding = 0;
tab.TopPadding = 0;

doc.Save(MyDir + @"17.7.docx");

希望,这对您有所帮助。

我在 Aspose 工作,担任开发人员传播者。