使用iTextSharp的自动分离色谱柱 [英] Auto Split Columns using iTextSharp

查看:97
本文介绍了使用iTextSharp的自动分离色谱柱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有需要导出为PDF一个网格,网格有28列。我使用的iText写PDF格式。问题是-Itext书面方式只有13列其余列在PDF到来。

I have a grid that need to be exported to PDF, grid has 28 columns. I am using iText to write the pdf. Issue -Itext is writting only 13 columns rest columns are not coming in PDF.

页大小设置为A4.Rotate()。

Page Size is set as A4.Rotate().

时没有什么办法,其余的列可自动书写下页?

Is there any way that remaining columns can be auto written on next page?

推荐答案

iText的将行拆分表,但没有列。如果你想这样做,你将不得不做手工。 PdfPTable 有一个名为的 WriteSelectedRows() ,允许你指定一个X,Y坐标绘制一个给定的范围行和列的通过。要做到这一点,你可能需要知道表格的宽度/高度,这里看到帖子的示例如何做到这一点。

iText will split a table at rows but not at columns. If you want to do that you'll have to do it manually. PdfPTable has a method called WriteSelectedRows() that allows you to specify an X,Y coordinate to draw a given range of rows and columns to. To do that you'll probably need to know the width/height of the table, see the post here for an example of how to do it.

另一种方式,这是一个更加怪异但更明显且不易出错,将只是让额外的表。表1有13列,表2有10列和表3有5列(或任何为您的数据有效)。在一天结束的时候,结果是几乎相同的,但你也可以得到自动表头和行分裂和你不必计算宽度和/或高度。

The other way, which is a little weirder but more obvious and less error prone, would be to just make extra tables. Table 1 has 13 columns, Table 2 has 10 columns and Table 3 has 5 columns (or whatever works for your data). At the end of the day, the result is pretty much the same but you also get automatic table headers and row splitting and you don't have to calculate widths and/or heights.

这篇关于使用iTextSharp的自动分离色谱柱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆