用 iTextSharp 5 如何让表格中的单元格能跨页

Yanbin_Q 2010-05-21 02:41:19
如果是 iTextSharp 4 的话,设置表格的
pdfTable.CellsFitPage = false;

就可以让单元格跨页显示,单元格跨页了不至于产生,第一行显示一行,而第二行在当页显示不下时,第一页就只会显示第一行的很少的内容。
...全文
451 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
白云任去留 2010-05-21
  • 打赏
  • 举报
回复
看看...
Yanbin_Q 2010-05-21
  • 打赏
  • 举报
回复
要这样
pdfTable.SplitLate = false;
pdfTable.SplitRows = true;

You should add the table to the document using Document.Add() if you want automatic splitting of the rows across pages. Then SplitLate and SplitRows will work as expected.

When SplitLate = true (default) the table will be split before the next row that does fit on the page. When SplitLate = false the row that does not fully fit on the page will be split. When SplitRows = true (default) the row that does not fit on a page will be be split. When SplitRows = false the row will be omitted.

So SplitLate && SplitRows: A row that does not fit on the page will be started on the next page and eventually split if it does not fit on that page either.

SplitLate && !SplitRows: A row that does not fit on the page will be started on the next page and omitted if it does not fit on that page either.

!SplitLate && SplitRows: A row that does not fit on the page will be split and continued on the next page and split again if it to last for the next page too.

!SplitLate && !SplitRows: I'm a little unsure about this one. But from the sources it looks like it's the same as SplitLate && !SplitRows: A row that does not fit on the page will be started on the next page and omitted if it does not fit on that page either.

But as for your question: Document.Add() will only be usable if the table is not needed to be absolutely positioned. But it's seems like there is a way to do it though by adding the table to a ColumnText (it's actually a ColumnText object that does all the table splitting) and then absolutyly position that ColumnText. I haven't looked into it yet, but I will as soon as I get a little more time :)
Ricercar 2010-05-21
  • 打赏
  • 举报
回复
我是看java版的手册上说有这么两个属性,原来没用啊?
Yanbin_Q 2010-05-21
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 ricercar 的回复:]
table.SplitLate = false;
table.SplitRows = false;
[/Quote]

看起来是这么个意思,可以我设置了这两个属性为 false 也不行啊,第一页还只是显示了一小行记录。
Ricercar 2010-05-21
  • 打赏
  • 举报
回复
table.SplitLate = false;
table.SplitRows = false;
q107770540 2010-05-21
  • 打赏
  • 举报
回复
没用过,帮顶

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧