Java iText操作PDF文档(五)

2014-11-24 03:29:11 · 作者: · 浏览: 3
IDDLE);
proinfoCell.setHorizontalAlignment(Cell.ALIGN_CENTER);
proinfoTab.addCell(proinfoCell);

// 单位名称
if (doc.getDocCorpName() == null) {
proinfoCell = new Cell(new Paragraph("无", ST));
} else {
proinfoCell = new Cell(new Paragraph(doc
.getDocCorpName(), ST));
}
proinfoCell.setUseAscender(true);
proinfoCell.setVerticalAlignment(Cell.ALIGN_MIDDLE);
proinfoCell.setHorizontalAlignment(Cell.ALIGN_CENTER);
proinfoTab.addCell(proinfoCell);

// 基地类型
if (doc.getDocCorpKind().equals("0")) {
proinfoCell = new Cell(new Paragraph("科普教育基地", ST));
} else if (doc.getDocCorpKind().equals("1")) {
proinfoCell = new Cell(new Paragraph("科普培训基地", ST));
} else if (doc.getDocCorpKind().equals("2")) {
proinfoCell = new Cell(new Paragraph("科普传媒基地", ST));
} else if (doc.getDocCorpKind().equals("3")) {
proinfoCell = new Cell(new Paragraph("科普研发基地", ST));
} else {
proinfoCell = new Cell(new Paragraph("无基地类型", ST));
}
proinfoCell.setUseAscender(true);
proinfoCell.setVerticalAlignment(Cell.ALIGN_MIDDLE);
proinfoCell.setHorizontalAlignment(Cell.ALIGN_CENTER);
proinfoTab.addCell(proinfoCell);

// 基地评分
if (bbp.getZongpoint() == null) {
proinfoCell = new Cell(new Paragraph("0", ST));
} else {
proinfoCell = new Cell(new Paragraph(String
.valueOf(Math.round(bbp.getZongpoint())), ST)); // 基地分数
}
proinfoCell.setUseAscender(true);
proinfoCell.setVerticalAlignment(Cell.ALIGN_MIDDLE);
proinfoCell.setHorizontalAlignment(Cell.ALIGN_CENTER);
proinfoTab.addCell(proinfoCell);

// 分数等级
if (bbp.getGrade() == null) {
proinfoCell = new Cell(new Paragraph("无", ST));
} else {
proinfoCell = new Cell(
new Paragraph(bbp.getGrade(), ST));
}
proinfoCell.setUseAscender(true);
proinfoCell.setVerticalAlignment(Cell.ALIGN_MIDDLE);
proinfoCell.setHorizontalAlignment(Cell.ALIGN_CENTER);
proinfoTab.addCell(proinfoCell);

// 专家评语
String opinion = bbp.getOpinion();
if (opinion != null) {
opinion = opinion.replaceAll("

", "\r\n");
opinion = opinion.replaceAll("

", "\r\n");