hssfrow 单元格样式

编程入门 行业动态 更新时间:2024-10-08 20:39:53

hssfrow <a href=https://www.elefans.com/category/jswz/34/1770080.html style=单元格样式"/>

hssfrow 单元格样式

导出一个人员Excel表格,代码如下,制作例子说明,可以直接复制:

public static void main(String[] args) throws IOException {

HSSFWorkbook book = new HSSFWorkbook();

HSSFSheet sheet = book.createSheet("Info");

HSSFRow header = sheet.createRow(0);

header.createCell(0).setCellValue("序号");

header.createCell(1).setCellValue("学号");

header.createCell(2).setCellValue("姓名");

header.createCell(3).setCellValue("年龄");

header.createCell(4).setCellValue("人员标编号");

header.createCell(5).setCellValue("地址");

header.createCell(6).setCellValue("电话");

header = sheet.createRow(1);

header.createCell(0).setCellValue("1");

header.createCell(1).setCellValue("1");

header.createCell(2).setCellValue("张三");

header.createCell(3).setCellValue("18");

header.createCell(4).setCellValue("00001");

header.createCell(5).setCellValue("一街二号");

header.createCell(6).setCellValue("1234567890");

FileOutputStream fos;

try {

fos = new FileOutputStream("d:/test.xls");

book.write(fos);

fos.close();

} catch (FileNotFoundException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

更多推荐

hssfrow 单元格样式

本文发布于:2024-03-07 21:42:34,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1718979.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:单元格   样式   hssfrow

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!