JAVA利用poi如何向excel已合并的单元格中写入内容?
1个回答
2013-08-02
展开全部
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("new sheet");
HSSFRow row = sheet.createRow((short) 1);
HSSFCell cell = row.createCell((short) 1);
HSSFRichTextString content = new HSSFRichTextString("This is a test of message");
cell.setCellValue(content);
sheet.addMergedRegion(new Region(1,(short)1,1,(short)2));
FileOutputStream fileOut = new FileOutputStream("d:/Demo_02_05.xls");
wb.write(fileOut);
fileOut.close();
HSSFSheet sheet = wb.createSheet("new sheet");
HSSFRow row = sheet.createRow((short) 1);
HSSFCell cell = row.createCell((short) 1);
HSSFRichTextString content = new HSSFRichTextString("This is a test of message");
cell.setCellValue(content);
sheet.addMergedRegion(new Region(1,(short)1,1,(short)2));
FileOutputStream fileOut = new FileOutputStream("d:/Demo_02_05.xls");
wb.write(fileOut);
fileOut.close();
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询