poi haven't support every function of excel, it's seems no good solution for your problem until new version poi has been released. But for our project purpose we offten only need create some excel file to end user, after that , we do nothing else.
郁闷中,只谈技术同美食
郁闷中,只谈技术同美食
------------------------------------------------------------------
import java.io.*;
import org.apache.poi.hssf.usermodel.*;
import org.apache.poi.poifs.filesystem.*;class ReadingandRewritingWorkbooks
{ public static void main (String args[]) throws IOException
{
POIFSFileSystem fs =
new POIFSFileSystem(new FileInputStream("ReadingandRewritingWorkbooks.xls"));
HSSFWorkbook wb = new HSSFWorkbook(fs);
HSSFSheet sheet = wb.getSheetAt(0);
HSSFRow row = sheet.getRow(2);
HSSFCell cell = row.getCell((short)3);
if (cell == null)
cell = row.createCell((short)3);
cell.setCellType(HSSFCell.CELL_TYPE_STRING);
cell.setCellValue("test"); // Write the output to a file
FileOutputStream fileOut = new FileOutputStream("ReadingandRewritingWorkbooks.xls");
wb.write(fileOut);
fileOut.close();
}
}