tablemain.addCell(datatablelevel);
/**********************************************/
//打印IP信息
String serverip = (String) serveriplist.get(i);
par = new Paragraph("IP: " + serverip, FontChinese);
datatableip.addCell(par);
AppBean appvo = new AppBean();
appvo = pdfdao.getIPMessage(serverip);
if(appvo.getAppName() != null){
par = new Paragraph("别名:" + appvo.getAppName(), FontChinese);
}
else{
par = new Paragraph("别名:", FontChinese);
}
datatableip.addCell(par);
if(appvo.getAppOS() != null){
par = new Paragraph("操作系统:" + appvo.getAppOS(), FontChinese);
}
else{
par = new Paragraph("操作系统:", FontChinese);
}
datatableip.addCell(par);
if(appvo.getHostAppType() != null){
par = new Paragraph("主机应用类型:" + appvo.getHostAppType(), FontChinese);
}
else{
par = new Paragraph("主机应用类型:", FontChinese);
}
datatableip.addCell(par);
if(appvo.getAppDescription() != null){
par = new Paragraph("主机描述:" + appvo.getAppDescription(), FontChinese);
}
else{
par = new Paragraph("主机描述:", FontChinese);
}
datatableip.addCell(par);
//打印日志级别信息及次数
if (levellist != null && levellist.size() > 0) {
for (int j = 0; j < levellist.size(); j++) {
ReportPdfVO pdfvo = (ReportPdfVO) levellist.get(j);
if (pdfvo != null && pdfvo.getLogleveldesc() != null &&
pdfvo.getServerIP().equals(serverip)) {
par = new Paragraph(pdfvo.getLogleveldesc(),
FontChinese);
datatablelevel.addCell(par);
par = new Paragraph((new Integer(pdfvo.getTimes())).
toString(), FontChinese);
datatablelevel.addCell(par);
}
}
}
document.add(tablemain); //加载新表
if (i != serveriplist.size() - 1) {
par = new Paragraph("主机及其数据库审计重要操作及其违禁操作", FontChinese);
document.add(par);
par = new Paragraph(" ", FontChinese);
document.add(par);
}
}
}
} catch (DocumentException de) {
de.printStackTrace();
System.err.println("document: " + de.getMessage());
}
// step 5: we close the document (the outputstream is also closed internally)
document.close();
}
public static void main(String[] args) {
// TODO Auto-generated method stub
ReportPDFNew a = new ReportPDFNew();
try {
a.getPDF("2007-2-1", "2007-4-8");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}