/**
* 模板导出 1
*/
@RequestMapping(value = "/export1")
public void Exceltest1(HttpServletResponse response) throws Exception {
try {
//读取模板
XSSFWorkbook workbook =
new XSSFWorkbook(Objects.requireNonNull(Test2.class.getResourceAsStream("/excel/模板.xlsx")));
XSSFSheet sheet = workbook.getSheetAt(0);
XSSFRow row1 = sheet.getRow(2);
//设置样式
CellStyle[] cellStyles = new CellStyle[row1.getLastCellNum()];
for (int i = 0; i < cellStyles.length; i++) {
//获取每个单元格的样式
cellStyles[i] = row1.getCell(i).getCellStyle();
<