main
黄海 2 years ago
parent edb2638ffd
commit a8b7311e2e

@ -10,7 +10,6 @@ import org.apache.poi.xssf.usermodel.DefaultIndexedColorMap;
import org.apache.poi.xssf.usermodel.XSSFColor;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.HashMap;
@ -18,7 +17,7 @@ import java.util.List;
import java.util.Map;
public class TestExportExcel {
public static void main(String[] args) {
public static void main(String[] args) throws IOException {
//读取库
HikariCpPlugin hp = new HikariCpPlugin("jdbc:postgresql://10.10.14.71:5432/szjz_db", "postgres",
"DsideaL147258369", "org.postgresql.Driver");
@ -131,12 +130,8 @@ public class TestExportExcel {
cell.setCellStyle(style);
}
}
// 保存Excel文件
try (FileOutputStream outputStream = new FileOutputStream("c:/example.xlsx")) {
workbook.write(outputStream);
} catch (IOException e) {
e.printStackTrace();
}
FileOutputStream outputStream = new FileOutputStream("c:/example.xlsx");
workbook.write(outputStream);
}
}
Loading…
Cancel
Save