日期:2014-05-20  浏览次数:20991 次

jxl修改已有excel文件,就出警告,大家看看怎么回事
代码如下
 String filePath1="d:\\1.xls";
  String filePath2="d:\\2.xls";
  WritableWorkbook book=null;
  Workbook wb=null;
  try {
  System.out.println("open "+filePath1);
  wb=Workbook.getWorkbook(new File(filePath1));
  // 打开一个文件的副本,并且指定数据写回到原文件 
  System.out.println("open "+filePath2);
  book=Workbook.createWorkbook(new File(filePath2),wb);
  System.out.println("end open "+filePath2);
  WritableSheet sheet =book.getSheet(2);
  //WritableSheet sheet =book.getSheet(0);
  //Sheet sheet =book.getSheet("2818s_ConfigScript");
  Cell cell1 = sheet.getCell( 1,6); 
  String result1 = cell1.getContents(); 
  System.out.println(" result1:"+result1);
   
  Label labelcf = new Label(1, 0, "TPG");
  sheet.addCell(labelcf);
  book.write();
  Cell cell2 = sheet.getCell( 1,6); 
  String result2 = cell2.getContents(); 
  System.out.println(" result2:"+result2);
   
   
  } catch (Exception ee) {
  System.out.println(" An exception occures when export to excel files "+ee.toString());
  } finally {
  if(book!=null){
  try{
  book.close();
  }catch(Exception e){
   
  }
  }
  if(wb!=null){
  try{
  wb.close();
  }catch(Exception e){
   
  }
  }
  }
  }


Warning: Shared template formula is null - trying most recent formula template
Warning: Shared template formula is null - trying most recent formula template
Warning: Shared template formula is null - trying most recent formula template
Warning: Shared template formula is null - trying most recent formula template
Warning: Shared template formula is null - trying most recent formula template
Warning: Shared template formula is null - trying most recent formula template
Warning: Shared template formula is null - trying most recent formula template
Warning: Shared template formula is null - trying most recent formula template
Warning: Shared template formula is null - trying most recent formula template
Warning: Cell I1265 already contains data
Warning: Cell I1265 already contains data
Warning: Cell I1265 already contains data
Warning: Cell I1265 already contains data
Warning: Cell I1265 already contains data
Warning: Cell I1265 already contains data
Warning: Cell I1265 already contains data
Warning: Cell I1265 already contains data
Warning: Cell I1265 already contains data

------解决方案--------------------
不知道 你要干吗