You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by ken wat <ck...@gmail.com> on 2006/04/20 03:07:47 UTC

Unable read to file error

Dear all,


Got "unable to read file" error when opening a file created by POI.
To reproduce the case:
1) Create a Excel 2000 file with 2 work sheets- 1 work sheet with 3 buttons,
another work sheet with 6 buttons.
2) Run the following java code to read it and write it to another file. (
using library poi-2.5.1-final)
3) Using the Excel to open the file will got the error.


...

  String filename = args[0];
      POIFSFileSystem fs =  new POIFSFileSystem(new
FileInputStream(filename));
    HSSFWorkbook  wb = new HSSFWorkbook(fs,true);

FileOutputStream stream = new FileOutputStream(args[ 1 ]);
    wb.write(stream);
       stream.close();

.....

regards,

Coder