Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/23.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net iText7获取桌子高度_.net_Itext7 - Fatal编程技术网

.net iText7获取桌子高度

.net iText7获取桌子高度,.net,itext7,.net,Itext7,下面是我的代码片段 Dim table As iText.Layout.Element.Table = New iText.Layout.Element.Table(4) table.SetWidth(pagesize.GetWidth - 40) Dim something As Paragraph = New Paragraph("LONG TEXT") Dim cell as Cell = New Cell().Add(New Paragraph("Some Text").SetFont

下面是我的代码片段

Dim table As iText.Layout.Element.Table = New iText.Layout.Element.Table(4)
table.SetWidth(pagesize.GetWidth - 40)
Dim something As Paragraph = New Paragraph("LONG TEXT")

Dim cell as Cell = New Cell().Add(New Paragraph("Some Text").SetFont(timesNewRoman))
table.AddCell(cell)
table.AddCell(cell)
table.AddCell(cell)
table.AddCell(cell)

canvas.Add(table.SetMarginLeft(20))

Dim unit as UnitValue = table.GetHeight()
我总是拿不到任何东西作为桌子的高度?我不明白为什么。有没有办法让我知道桌子的高度?如果有区别的话,这个表格在我的标题中,所以当我想根据表格的放置位置设置文档边距时,所有文本都放在标题下。每次生成此pdf时,文本都会有所不同

Dim result As LayoutResult = table.CreateRendererSubTree().SetParent(doc.GetRenderer()).Layout(New LayoutContext(New LayoutArea(1, New Rectangle(0, 0, 400, 10000.0F))))
tableHeight = result.GetOccupiedArea().GetBBox().GetHeight()
这就是我如何在itext7中找到桌子的高度,希望它能帮助别人

这就是我如何在itext7中找到桌子的高度,希望它能帮助别人