iText 7.1,C# - 如何设置 table 宽度以跨越整个页面?

iText 7.1, C# - How to set table width to span the entire page?

我在 C# 中使用 iText 7(.1)。我有一个 table 数据。我希望 table 占据整个宽度。我该怎么做?

example code in the jumpstart tutorial,即:

var table = new Table(new float[]{4, 1, 3, 4, 3, 3, 3, 3, 1});
table.SetWidthPercent(100);

由于某种原因不太有效——Visual Studio 会抱怨 Table 不包含 SetWidthPercent().

的定义

你应该使用:

table.SetWidth(UnitValue.createPercentValue(100));

setWidthPercent() 方法是您在 iText 7.0 中使用的方法,但这在 7.1 中发生了变化。