赞
踩
<!-- poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.9</version>
</dependency>
@RequestMapping("/extUserTemp")
public void extUserTemp(HttpServletResponse response) {
try {
String[] title = {"员工工号", "姓名", "手机号"};
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet();
sheet.setDefaultRowHeight((short) 500);
sheet.setColumnWidth(0, 5000);
sheet.setColumnWidth(1, 5000);
sheet.setColumnWidth(2, 5000);
HSSFRow row = sheet.createRow(0);
HSSFCell cell = null;
row.setHeight((short) 500);
for (int i = 0; i < title.length; i++) {
cell = row.createCell(i);
cell.setCellValue(title[i]);
}
workbook.write(response.getOutputStream());
} catch (Exception e) {
e.printStackTrace();
}
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。