将JTable的特定列导出为PDF

将JTable的特定列导出为PDF,pdf,jtable,Pdf,Jtable,我想把我的JTable内容打印成PDF文件 我设法做到了,只是现在我想排除第二列并打印其他列,请问有什么有用的指南吗 for (int rows = 0; rows < jTable1.getRowCount(); rows++) { for (int cols = 0; cols < jTable1.getColumnCount(); cols++) { PdfPCell cell1 = new PdfPCe

我想把我的JTable内容打印成PDF文件

我设法做到了,只是现在我想排除第二列并打印其他列,请问有什么有用的指南吗

 for (int rows = 0; rows < jTable1.getRowCount(); rows++) {
                for (int cols = 0; cols < jTable1.getColumnCount(); cols++) {
                    PdfPCell cell1 = new PdfPCell(new Phrase(jTable1.getModel().getValueAt(rows,cols).toString(),cellFont));
                    pdfTable.addCell(cell1);
                }
            float[] columnWidths = new float[] {10f,1f,13f,35f,15f,25f,20f,15f,13f,
                    13f,12f,18f,13f,12f,47f,9f,47f};
                    pdfTable.setWidths(columnWidths);

            }
for(int rows=0;rows
我设法解决了这个问题,只需将0f作为我要隐藏的列的列宽