
java poi excel导出怎么制作标题
1个回答
展开全部
完整的例子就是这样的。样式自己加上就行了。
public static void main(String[] args) throws IOException {
String excelPath="d:/test.xls";//excel输出路径
File excel=new File(excelPath);
OutputStream out=new FileOutputStream(excel);
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet("标签名");
HSSFRow firstHeaderRow=sheet.createRow(0);// 第一行
sheet.addMergedRegion(new CellRangeAddress(0,0,0,8));
HSSFCell yearCell=firstHeaderRow.createCell(0);
yearCell.setCellValue("标题");
workbook.write(out);
out.flush();
out.close();
}
public static void main(String[] args) throws IOException {
String excelPath="d:/test.xls";//excel输出路径
File excel=new File(excelPath);
OutputStream out=new FileOutputStream(excel);
HSSFWorkbook workbook = new HSSFWorkbook();
HSSFSheet sheet = workbook.createSheet("标签名");
HSSFRow firstHeaderRow=sheet.createRow(0);// 第一行
sheet.addMergedRegion(new CellRangeAddress(0,0,0,8));
HSSFCell yearCell=firstHeaderRow.createCell(0);
yearCell.setCellValue("标题");
workbook.write(out);
out.flush();
out.close();
}

2024-07-20 广告
作为深圳市博思云创科技有限公司的工作人员,对于Word文档生成PPT的操作,我们有以下建议:1. 使用另存为功能:在Word中编辑完文档后,点击文件->另存为,选择PowerPoint演示文稿(*.pptx)格式,即可将文档内容转换为PPT...
点击进入详情页
本回答由博思aippt提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询