You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Duncan Krebs <du...@krebsnet.com> on 2004/09/29 07:36:44 UTC

Issue saving excel files that contain userforms

Hi,
I'm having an issue when saving an excel POIFS that contains one or more
excel userforms. I do not get an exception in my code but when I open
the file in excel and try to save it I get a "Document Not Saved"
message and the file will not save. Below is a few lines of code that is
generating the error, I've tried all sorts of things and can't figure
this one out. Any help would be greatly appreciated, I'm about to have
some unhappy clients! - dkrebs
 
String file = "C:\\myfile.xls";
FileInputStream inputstream = new FileInputStream(file);
POIFSFileSystem fs = new POIFSFileSystem(inputstream);
inputstream.close();
FileOutputStream writer = new FileOutputStream(file);
fs.writeFilesystem(writer);
writer.close();

RE: Issue saving excel files that contain userforms

Posted by Duncan Krebs <du...@krebsnet.com>.
Karl,
Thanks for the reply. I tested it with a single user form and the save
worked fine. My biggest concern however is that when I copy/paste the
user forms that I need one at a time I can get it to save okay but then
out of the blue I will run into the same problem again. If I remove all
of the user forms it then saves okay. It's creating a very unstable
situation. I think the bottom line is that POI is not good at dealing
with existing Workbooks that contain user forms. 

This may seem kind of like a corky solution, but as a work around I
created a simple workbook with no user forms and use POI to update a
couple of worksheets, then in my Java code I call a .Net console app
with some args[] that copies the sheets from the simple workbook into
the workbook containing the userforms. That’s the best I could come up
with.

I've actually used this similar tactic with other bugs in POI. For
example it craps out when it tries to open a workbook where a cell
containing drop down options is selected. I use a Microsoft app to first
open the workbook to be sure no drop down cells are selected. 

That is my number one complaint with this project, the upfront
limitations are not well highlighted. As I start to use it more and more
I keep finding more undocumented issues and can't turn back because I'm
in too deep :) 

If you have any ideas of what the underlying user form issue is please
let me know, I really don't like using Microsoft software.  - Duncan 


-----Original Message-----
From: KHZ (SAW) [mailto:karl-heinz.zengerle@sawag.com] 
Sent: Wednesday, September 29, 2004 4:30 AM
To: 'POI Users List'
Subject: AW: Issue saving excel files that contain userforms

Hi Duncan.

Does it also happen in a simple new file built from the scratch
containing a user form?

In other constellations we had problems although there was no exception.
We interpreted it like this: An Excel file with several changes most
probably isn't fully identical to one built directly from the scratch.

Regards,	Karl-Heinz.


-----Ursprüngliche Nachricht-----
Von: Duncan Krebs [mailto:duncan@krebsnet.com] 
Gesendet: Mittwoch, 29. September 2004 07:37
An: poi-user@jakarta.apache.org
Betreff: Issue saving excel files that contain userforms

Hi,
I'm having an issue when saving an excel POIFS that contains one or more
excel userforms. I do not get an exception in my code but when I open
the file in excel and try to save it I get a "Document Not Saved"
message and the file will not save. Below is a few lines of code that is
generating the error, I've tried all sorts of things and can't figure
this one out. Any help would be greatly appreciated, I'm about to have
some unhappy clients! - dkrebs
 
String file = "C:\\myfile.xls";
FileInputStream inputstream = new FileInputStream(file);
POIFSFileSystem fs = new POIFSFileSystem(inputstream);
inputstream.close();
FileOutputStream writer = new FileOutputStream(file);
fs.writeFilesystem(writer);
writer.close();



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


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


AW: Issue saving excel files that contain userforms

Posted by "KHZ (SAW)" <ka...@sawag.com>.
Hi Duncan.

Does it also happen in a simple new file built from the scratch
containing a user form?

In other constellations we had problems although there was no exception.
We interpreted it like this: An Excel file with several changes most
probably isn't fully identical to one built directly from the scratch.

Regards,	Karl-Heinz.


-----Ursprüngliche Nachricht-----
Von: Duncan Krebs [mailto:duncan@krebsnet.com] 
Gesendet: Mittwoch, 29. September 2004 07:37
An: poi-user@jakarta.apache.org
Betreff: Issue saving excel files that contain userforms

Hi,
I'm having an issue when saving an excel POIFS that contains one or more
excel userforms. I do not get an exception in my code but when I open
the file in excel and try to save it I get a "Document Not Saved"
message and the file will not save. Below is a few lines of code that is
generating the error, I've tried all sorts of things and can't figure
this one out. Any help would be greatly appreciated, I'm about to have
some unhappy clients! - dkrebs
 
String file = "C:\\myfile.xls";
FileInputStream inputstream = new FileInputStream(file);
POIFSFileSystem fs = new POIFSFileSystem(inputstream);
inputstream.close();
FileOutputStream writer = new FileOutputStream(file);
fs.writeFilesystem(writer);
writer.close();



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