|
|
|
@ -105,24 +105,24 @@ public class TemplateBaseUtil { |
|
|
|
table.addCell(cell); |
|
|
|
} |
|
|
|
if (StringUtils.isNoneBlank(instrument)) { |
|
|
|
// JSONArray jsonArray = JSONArray.parseArray(instrument); |
|
|
|
// int rowNum = 0; |
|
|
|
// for (int i = 0; i < jsonArray.size(); i++) { |
|
|
|
// JSONObject obj = jsonArray.getJSONObject(i); |
|
|
|
// // 交替行颜色 |
|
|
|
// if (rowNum % 2 == 0) { |
|
|
|
// table.getDefaultCell().setBackgroundColor(BaseColor.WHITE); |
|
|
|
// } else { |
|
|
|
// table.getDefaultCell().setBackgroundColor(BaseColor.WHITE); |
|
|
|
// } |
|
|
|
// table.addCell(PdfBaseUtil.createCell(obj.getString("mc"), contentFont)); |
|
|
|
// table.addCell(PdfBaseUtil.createCell(obj.getString("bh"), contentFont)); |
|
|
|
// table.addCell(PdfBaseUtil.createCell(obj.getString("ph"), contentFont)); |
|
|
|
// table.addCell(PdfBaseUtil.createCell(obj.getString("nd"), contentFont)); |
|
|
|
// table.addCell(PdfBaseUtil.createCell(obj.getString("source"), contentFont)); |
|
|
|
// table.addCell(PdfBaseUtil.createCell(StringUtils.isNoneBlank(obj.getString("sxrq")) ? obj.getString("sxrq") : "", contentFont)); |
|
|
|
// rowNum++; |
|
|
|
// } |
|
|
|
JSONArray jsonArray = JSONArray.parseArray(instrument); |
|
|
|
int rowNum = 0; |
|
|
|
for (int i = 0; i < jsonArray.size(); i++) { |
|
|
|
JSONObject obj = jsonArray.getJSONObject(i); |
|
|
|
// 交替行颜色 |
|
|
|
if (rowNum % 2 == 0) { |
|
|
|
table.getDefaultCell().setBackgroundColor(BaseColor.WHITE); |
|
|
|
} else { |
|
|
|
table.getDefaultCell().setBackgroundColor(BaseColor.WHITE); |
|
|
|
} |
|
|
|
table.addCell(PdfBaseUtil.createCell(obj.getString("mc"), contentFont)); |
|
|
|
table.addCell(PdfBaseUtil.createCell(obj.getString("bh"), contentFont)); |
|
|
|
table.addCell(PdfBaseUtil.createCell(obj.getString("ph"), contentFont)); |
|
|
|
table.addCell(PdfBaseUtil.createCell(obj.getString("nd"), contentFont)); |
|
|
|
table.addCell(PdfBaseUtil.createCell(obj.getString("source"), contentFont)); |
|
|
|
table.addCell(PdfBaseUtil.createCell(StringUtils.isNoneBlank(obj.getString("sxrq")) ? obj.getString("sxrq") : "", contentFont)); |
|
|
|
rowNum++; |
|
|
|
} |
|
|
|
} |
|
|
|
document.add(table); |
|
|
|
} |
|
|
|
|