【问题标题】:iText PdfPTable Rows FixingiText PdfPTable 行修复
【发布时间】:2012-06-21 20:06:57
【问题描述】:

我在我的应用程序中使用 iText。

我将向 iText PDF 生成器类发送一个数组集合。 该数组集合有 10 个项目,现在,我想在一个表格中显示这十个项目。

表格显示的条件是每页只显示5个项目,剩余的应该结转到下一页并显示在表格中。

float[] colsWidth = {0.5f,4f,1.4f,1.4f}; 
PdfPTable itemListTab = new PdfPTable(colsWidth);

有什么建议吗?

【问题讨论】:

    标签: java itext


    【解决方案1】:

    在遍历您的数组时,每隔五个元素,将您的表格添加到文档中,开始一个新页面,然后创建一个新表格。

    if (/* 5 elements */) {
        // add your table to the document
        document.add(itemListTab);
    
        // create a new page
        document.newPage();
    
        // create a new table
        itemListTab = new PdfPTable(colsWidth);
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-07-22
      • 2012-11-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多