main
黄海 2 years ago
parent 15d22af30f
commit 467589c2f0

@ -48,8 +48,6 @@ public class TestRegex {
public static void ExportExcel(List<Record> list, List<Record> errlist) throws IOException {
XSSFWorkbook xssfWorkbook = new XSSFWorkbook(new FileInputStream(path));
XSSFSheet sheet1 = xssfWorkbook.getSheetAt(0);
//正文与表头不是一个颜色
XSSFFont txtFont = xssfWorkbook.createFont();
txtFont.setFontHeightInPoints((short) 11); //字体大小
txtFont.setFontName("等线"); //字体
@ -86,31 +84,31 @@ public class TestRegex {
//调整宽度
sheet1.setColumnWidth(14, 512 * 50 + 184);
//填充
for (int i = 0; i < list.size(); i++) {
Record record = list.get(i);
int id = record.getInt("id");
String zhuanye = record.getStr("zhuanye");
String xf = record.getStr("xf");
String memo = record.getStr("memo");
try {
row = sheet1.getRow(id + 1);
cell = row.createCell(12);
cell.setCellValue(zhuanye);
cell.setCellStyle(cellStyleTxt);
cell = row.createCell(13);
cell.setCellValue(xf);
cell.setCellStyle(cellStyleTxt);
cell = row.createCell(14);
cell.setCellValue(memo);
cell.setCellStyle(cellStyleTxt);
} catch (Exception err) {
System.out.println(err.toString());
}
}
// //填充
// for (int i = 0; i < list.size(); i++) {
// Record record = list.get(i);
// int id = record.getInt("id");
// String zhuanye = record.getStr("zhuanye");
// String xf = record.getStr("xf");
// String memo = record.getStr("memo");
// try {
// row = sheet1.getRow(id + 1);
// cell = row.createCell(12);
// cell.setCellValue(zhuanye);
// cell.setCellStyle(cellStyleTxt);
//
// cell = row.createCell(13);
// cell.setCellValue(xf);
// cell.setCellStyle(cellStyleTxt);
//
// cell = row.createCell(14);
// cell.setCellValue(memo);
// cell.setCellStyle(cellStyleTxt);
// } catch (Exception err) {
// System.out.println(err.toString());
// }
// }
// //写入异常数据
// XSSFSheet sheet2 = xssfWorkbook.getSheetAt(1);
// for (int i = 0; i < errlist.size(); i++) {

Loading…
Cancel
Save