我使用了
以下是我的代码以排列单个单元格。
POI
并尝试整列排列。但是我找到的方式只能安排单个单元格。虽然我找到了sheet.setDefaultColumnStyle()
并尝试使用此函数,但它根本不起作用。
您可以让我知道如何使用setDefaultColumnStyle()
或其他方法吗?以下是我的代码以排列单个单元格。
xlsxFile = new File("data.xlsx");
wb = new XSSFWorkbook();
cellStyle = wb.createCellStyle();
cellStyle.setAlignment(CellStyle.ALIGN_CENTER);
cellStyle.setVerticalAlignment(CellStyle.VERTICAL_CENTER);
row = sheet1.createRow(0);
cell = row.createCell(1);
cell.setCellValue("name");
cell.setCellStyle(cellStyle);
我的英语能力有些生疏。感谢您的阅读。如果有任何奇怪的地方,请告诉我。