You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Pawel looser <lo...@wp.pl> on 2007/06/12 14:29:00 UTC

Excel macros

Hello,
I would like to know, if anyone of you tried to save excel file without 
macros? I know, that there is flag named "preserveNodes" in constructor 
of HSSFWorkbook. But when I create instance of HSSFWorkbook with this 
flag set to false and then save it to file (with method 
"write(OutputStream)") File seems to be corrupted and some info about 
macros is still avaible. When i try open this file i get message that 
there is lost project in Visual Basic.
I am using Excel 2003, when i try to write file in compability mode 
(Excel 97) result is the same.

Sample code which couse this behaviour:

---------------------------------------------
FileInputStream file = new FileInputStream(
          "path to file with macro");

      POIFSFileSystem fs = new POIFSFileSystem(file);
      file.close();
      HSSFWorkbook template = new HSSFWorkbook(fs, false); // preserve nodes
     

      FileOutputStream file2 = new FileOutputStream("path to result file");
      template.write(file2);
      file2.close();
---------------------------------------------

thanks,
Pawel

----------------------------------------------------
ROLLING STONES - A BIGGER BANG
Warszawa Służewiec 25 lipca 2007 r. 
http://klik.wp.pl/?adr=http%3A%2F%2Fadv.reklama.wp.pl%2Fas%2Frollingstones.html&sid=1186



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org