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();本回答被网友采纳
相似回答