日期:2014-05-18  浏览次数:20757 次

jxl写excel的问题
public   class   OutExl   {

public   static   void   main(String   args[])
        {
    try{
          OutputStream   os=new     FileOutputStream( "c:\\ee.xls ");//输出的Excel文件URL  
          WritableWorkbook   wwb   =   Workbook.createWorkbook(os);//创建可写工作薄
          WritableSheet   ws   =   wwb.createSheet( "sheet1 ",   0);//创建可写工作表  
          Label   labelCF=new   Label(0,   0,   "hello ");//创建写入位置和内容
          ws.addCell(labelCF);//将Label写入sheet中
          WritableFont   wf   =   new   WritableFont(WritableFont.TIMES,   12,   WritableFont.BOLD,   false);//设置写入字体
          WritableCellFormat   wcfF   =   new   WritableCellFormat(wf);//设置CellFormat   Label  
          labelCF=new   Label(0,   0,   "hello ");//创建写入位置,内容和格式   Label的另一构造函数
          ///Label(int   c,   int   r,   String   cont,   CellFormat   st)//可以对写入内容进行格式化,设置字体及其它的属性.  
          wwb.write();  
          wwb.close();  
          os.close();  
    }catch(FileNotFoundException   e){
  e.printStackTrace();
    }catch(IOException   e){
  e.printStackTrace();
  }catch(WriteException   e){
  e.printStackTrace();
  }

        }
}
怎么老是报java.io.FileNotFoundException:   c:\ee.xls   (请求的操作无法在使用用户映射区域打开的文件上执行。)
at   java.io.FileOutputStream.open(Native   Method)
at   java.io.FileOutputStream. <init> (Unknown   Source)
at   java.io.FileOutputStream. <init> (Unknown   Source)
at   com.platform.common.OutExl.main(OutExl.java:21)
c盘有这个文件,读的时候可以,但写却不行   晕了

------解决方案--------------------
程序执行的时候文件是否是打开的?