匿名用户
1级
2014-09-20 回答
如果不好使,你可以试试POI下的这个,我技术也一般,希望能对你有帮助。
public static void main(String[] args) {
HSSFWorkbook wbReport = null;
File reportFile = null;
FileInputStream filein = null;
POIFSFileSystem fs = null;
FileOutputStream outReport = null;
String strTmpltFilePath = "";
// 文件名 路径
strTmpltFilePath = "C:\\Documents and Settings\\suiran_d30109\\Desktop\\ZDClogfile\\TODOOOOO\\コピー ~ ToDoツール.xls";
File fileAgtTmplt = new File(strTmpltFilePath);
// レポートEXCELに设定
try {
filein = new FileInputStream(fileAgtTmplt);
fs = new POIFSFileSystem(filein);
wbReport = new HSSFWorkbook(fs);
// 获取Sheet名
HSSFSheet stReport = wbReport.getSheet("ツール");
HSSFRow rowReport = stReport.getRow(5);
HSSFCell cellReport = rowReport.getCell(2);
cellReport.setCellValue("123123");
// レポートデータ保存
outReport = new FileOutputStream(fileAgtTmplt);
wbReport.write(outReport);
outReport.flush();
outReport.close();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}