-1
私はItextでドキュメントを作成していて、4つのメインCellに分解しています。ドキュメントの最後のセルを作成していますが、表示するすべての行の最初のセル以外は取得できません。テーブルITextで正しいセルが追加されない
私が主な文書に追加しているセルを返す関数です。ここ
public PdfPCell getPSBioCell() {
PdfPCell spaceCell = new PdfPCell(new Phrase(""));
spaceCell.setColspan(1); // space
spaceCell.setBorder(0);
PdfPTable table = new PdfPTable(4);
PdfPCell main = new PdfPCell();
noBorder(main);//
main.setPadding(0);//
PdfPCell dist = new PdfPCell(new Phrase(_rangerDistrict, nf));
PdfPCell district = new PdfPCell(new Phrase(this.sale.getRangerDistrict(), nf));
PdfPCell saleD = new PdfPCell(new Phrase(_saleDate, nf));
PdfPCell saleDate = new PdfPCell(new Phrase(this.formatDateString(sale.getSaleDate()), nf));
PdfPCell awardD = new PdfPCell(new Phrase(_awardDate, nf));
PdfPCell awardDate = new PdfPCell(new Phrase(this.formatDateString(sale.getAwardDate()), nf));
PdfPCell termD = new PdfPCell(new Phrase(_termDate, nf));
PdfPCell termDate = new PdfPCell(new Phrase(this.formatDateString(sale.getTerminationDate()), nf));
PdfPCell avg = new PdfPCell(new Phrase(_avgDbh , nf));
PdfPCell avgDbh = new PdfPCell(new Phrase(this.formatNumberString(String.valueOf(sale.getAveDiam())), nf));
PdfPCell cruis = new PdfPCell(new Phrase(_cruiser, nf));
PdfPCell cruiser = new PdfPCell(new Phrase(sale.getCruiser(), nf));
noBorder(dist, district, saleD, saleDate);
noBorder(awardD, awardDate, termD, termDate, avg);
noBorder(avgDbh, cruis, cruiser);
//
table.addCell(dist);
table.addCell(district);
table.addCell(spaceCell);
table.addCell(spaceCell);
//
table.addCell(saleD);
table.addCell(saleDate);
table.addCell(spaceCell);
table.addCell(spaceCell);
//
table.addCell(awardD);
table.addCell(awardDate);
table.addCell(spaceCell);
table.addCell(spaceCell);
//
table.addCell(termD);
table.addCell(termDate);
table.addCell(spaceCell);
table.addCell(spaceCell);
//
table.addCell(avg);
table.addCell(avgDbh);
table.addCell(spaceCell);
table.addCell(spaceCell);
//
table.addCell(cruis);
table.addCell(cruiser);
table.addCell(spaceCell);
table.addCell(spaceCell);
table.setWidthPercentage(100);
main.addElement(table);
return main;
}
コードを、余分な作業をせずにダウンロードして実行できるスタンドアロンの例に変更してください。誰かが見ているかもしれません。さて、あなたはテストのための努力が必要なコードを貼り付けました。多くの人がそれを一緒にスタンドアロンの例にパズルする時間はありません。そのような人は怠け者だと思うかもしれませんが、スタンドアロンの例を提供していないという理由で、あなたのことについて同じことを考えるかもしれないということを考慮してください。結局のところ:あなたはおそらくあなたの仕事のために支払われます。 SO上の人は、彼らの答えを支払われません。 –
私はコードを見て、@ Brunoが正しいと言わなければなりません。水晶球からの入力を追加することなく、問題を再現しようとするとコードには未知の要素(メンバー変数の値とメソッド呼び出しの戻り値)が非常に多くあります。 – mkl