【发布时间】:2013-12-31 22:34:11
【问题描述】:
使用iText 并使用表格单元格。
我在一张表中有25 cells (columns)。
每列内容旋转90度,需要适合每个单元格的高度。
在某些情况下,当内容的长度超过单元格的高度时,并非所有内容都可见(Only the part of content is visible that is fitted to the height of the cell, the rest is dropped)。我想获取丢弃的内容并希望在下一个相邻单元格中显示它。
使用如下代码 -
PdfPCell cell;
for(int i = 0;i< 25;i++)
{
if(locs.get(i) == null)
{
cell = new PdfPCell();
cell.setBorder(0);
table.addCell(cell);
}
else
{
Font font = new Font(FontFamily.HELVETICA, 9, Font.BOLD, BaseColor.BLACK);
cell = new PdfPCell(new Phrase(locs.get(i), font));
cell.setRotation(90);
cell.setBorder(0);
cell.setFixedHeight(110f);
//cell.setMinimumHeight(10f);
table.addCell(cell);
}
}
因此,如果 locs.get(i) 的值大于单元格的高度 (cell height is fixed to 110f in the above code),则某些不适合的内容将被丢弃以显示在视图中。
如何获取该内容并将其显示到相邻单元格?
【问题讨论】:
标签: java android pdf-generation itext cell