1

列内に新しい空白行を挿入する方法を教えてくださいPdfPTable\nそしてn number of spaces私のためにトリックをしていません。これは私が取り組んでいるJavaコードです。

chtbc_report1_table.setModel(new javax.swing.table.DefaultTableModel(
new Object [][] {
    {"H.B.G", "Some Value", "lbs/kg", "Adult M : 120lbs \n Adult F : 90lbs"},
    .....
    .....
    //Other rows
    },
new String [] {
    "Investigation", "Result", "Unit", "Weight"
}
));

new line「大人M:120lbs**\n**大人F:90lbs」の間に入れたい

更新

これは、私が作成に使用したコードですPdfPTable

document.open();

    PdfPTable pdfTable = new PdfPTable(chtbc_report1_table.getColumnCount());    
    for (int rows = 0; rows < chtbc_report1_table.getRowCount(); rows++) {
        for (int cols = 0; cols < chtbc_report1_table.getColumnCount(); cols++) {
            pdfTable.addCell(chtbc_report1_table.getModel().getValueAt(rows, cols).toString());

        }
    }
    float[] columnWidths_pdfTable = new float[]{30f, 25f, 40f, 50f};
    pdfTable.setWidths(columnWidths_pdfTable);
    document.add(pdfTable);

document.close()

どんな提案も役に立ちます。

4

1 に答える 1