- PR -

iTextのネストしたテーブルについて

1
投稿者投稿内容
ボルビ
ベテラン
会議室デビュー日: 2007/05/23
投稿数: 52
投稿日時: 2007-06-13 20:21
java:1.4.2_09,itext-2.0.1

お世話になっています。

テーブルとネストしたテーブルとの間の空白をなくしたいのですが、
思うように旨くいきません。知ってる方がいましたらご教授お願い致します。

Document doc = new Document(PageSize.A4,5f,5f,5f,5f);

PdfPTable table5 = new PdfPTable(4);
PdfPTable nested1 = new PdfPTable(2);
nested1.addCell("1.1");
nested1.addCell("1.2");
PdfPTable nested2 = new PdfPTable(1);
nested2.addCell("2.1");
nested2.addCell("2.2");
table5.addCell("cell " + 0);
table5.addCell("cell " + 1);
table5.addCell(nested1);
table5.addCell(nested2);
doc.add(table5);
doc.close();
ボルビ
ベテラン
会議室デビュー日: 2007/05/23
投稿数: 52
投稿日時: 2007-06-14 11:56
自己解決しました。

下記の追加項目を入れてみたらテーブルとネストテーブルの間の
空白が消えました。頭がボーとしてるとだめですね〜。

Document doc = new Document(PageSize.A4,5f,5f,5f,5f);

PdfPTable table5 = new PdfPTable(4);
-------------------------------------------追加
table5.getDefaultCell().setPadding(0f);
-------------------------------------------
PdfPTable nested1 = new PdfPTable(2);
nested1.addCell("1.1");
nested1.addCell("1.2");
PdfPTable nested2 = new PdfPTable(1);
nested2.addCell("2.1");
nested2.addCell("2.2");
table5.addCell("cell " + 0);
table5.addCell("cell " + 1);
table5.addCell(nested1);
table5.addCell(nested2);
doc.add(table5);
doc.close();
1

スキルアップ/キャリアアップ(JOB@IT)