You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by bu...@apache.org on 2008/07/18 11:42:57 UTC

DO NOT REPLY [Bug 45431] New: XSSFWorkbook cannot save a macro-enabled Excel (.xlsm)

https://issues.apache.org/bugzilla/show_bug.cgi?id=45431

           Summary: XSSFWorkbook cannot save a macro-enabled Excel (.xlsm)
           Product: POI
           Version: unspecified
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: normal
          Priority: P2
         Component: HSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: matthew.knl@gmail.com


I am using POI 3.5 Beta 1.
When I open a macro-enabled Excel (.xlsm) and save it as .xslm again.
The result file cannot be opened by MS Excel 2007.

Following is my sample codes:

XSSFWorkbook wb = new XSSFWorkbook("input.xlsm");
FileOutputStream outStream = new FileOutputStream("output.xlsm");
wb.write(outStream);

Is that currently POI not support a macro-enabled Excel file? Thanks a lot.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 45431] XSSFWorkbook cannot save a macro-enabled Excel (.xlsm)

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45431


Nick Burch <ni...@torchbox.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |NEEDINFO




--- Comment #8 from Nick Burch <ni...@torchbox.com>  2008-07-29 16:04:04 PST ---
Could you upload a file similar to the one your image shows? I'd like one like
that so I can write some more comprehensive unit tests for this stuff


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 45431] XSSFWorkbook cannot save a macro-enabled Excel (.xlsm)

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45431


Matthew <ma...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|                            |FIXED




--- Comment #10 from Matthew <ma...@gmail.com>  2008-12-30 01:47:18 PST ---
This problem is solved in latest build.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 45431] XSSFWorkbook cannot save a macro-enabled Excel (.xlsm)

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45431





--- Comment #9 from Nick Burch <ni...@torchbox.com>  2008-07-29 17:31:19 PST ---
Thanks for you patch. I've applied it to the svn branch, with some changes. I
decided it'd make sense if we pushed a lot of the fiddly bits around reading
and writing the sub-streams to XSSFRelation, rather than duplicating it each
time. So, the code in XSSFWorkbook is very different, the others less so

I'm able to open your initial file, save it, and have excel load it with no
issues. Hopefully your complex file will work too, but please upload it so we
can write unit tests for it :)


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 45431] XSSFWorkbook cannot save a macro-enabled Excel (. xlsm)

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45431





--- Comment #1 from Matthew <ma...@gmail.com>  2008-07-18 02:44:02 PST ---
Created an attachment (id=22280)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22280)
Input Excel File


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 45431] XSSFWorkbook cannot save a macro-enabled Excel (. xlsm)

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45431





--- Comment #5 from Matthew <ma...@gmail.com>  2008-07-20 18:55:25 PST ---
Created an attachment (id=22290)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22290)
My patch to solve "save macro-enabled workbook" issue, temporary solution 


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 45431] XSSFWorkbook cannot save a macro-enabled Excel (. xlsm)

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45431





--- Comment #7 from Nick Burch <ni...@torchbox.com>  2008-07-28 16:37:47 PST ---
I've got poi using the latest openxml4j, so hopefully things will now work fine
for you

I'll try to review + commit your patch in the near future


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 45431] XSSFWorkbook cannot save a macro-enabled Excel (. xlsm)

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45431





--- Comment #4 from Matthew <ma...@gmail.com>  2008-07-20 18:54:17 PST ---
Created an attachment (id=22289)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=22289)
Macro-enabled workbook package structure: vmlDrawing, activeX...


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 45431] XSSFWorkbook cannot save a macro-enabled Excel (. xlsm)

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45431


Matthew <ma...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |NEW




--- Comment #3 from Matthew <ma...@gmail.com>  2008-07-20 18:48:36 PST ---
I compared the pre-poi and post-poi files, I have following findings:

(1) In [Content_Types].xml:

Excel expected output:
<Override PartName="/xl/workbook.xml"
ContentType="application/vnd.ms-excel.sheet.macroEnabled.main+xml"/>

POI actual output:
<Override PartName="/xl/workbook.xml"
ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/>

(2) In [Content_Types].xml:

Excel expected output:
<Default Extension="vml"
ContentType="application/vnd.openxmlformats-officedocument.vmlDrawing"/>
<Override PartName="/xl/vbaProject0.bin"
ContentType="application/vnd.ms-office.vbaProject"/>

POI actual output (the case difference):
<Default Extension="vml"
ContentType="application/vnd.openxmlformats-officedocument.vmldrawing"/>
<Override PartName="/xl/vbaProject0.bin"
ContentType="application/vnd.ms-office.vbaproject"/>

I found that this problem is caused by OpenXml4J
(http://people.apache.org/~nick/openxml4j-bin-alpha-080407.jar), I tried to use
the library with a newer version, it fix this issue but I encountered another
problem which doesn't happen in older version.

(3) Package contents:
Some .xlsm file contains not only vbaProject.bin, it also includes ActiveX
controls and some .emf image files linked. If only copy the vbaProject.bin
without the linked ActiveX controls and image, Excel will prompt error also.
Please check my attached image.

Patch
=====
I have created a patch which solve above problems (assume OpenXML4J (2) issue
is fixed), but I know the patch just only solve my problem temporary (I hard
code the output is macro-enabled workbook, image is .emf etc...) and it is not
a generic solution for the POI project. I hope it helps the POI team to figure
out the perfect solution some ways.


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 45431] XSSFWorkbook cannot save a macro-enabled Excel (. xlsm)

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45431


Nick Burch <ni...@torchbox.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED




--- Comment #6 from Nick Burch <ni...@torchbox.com>  2008-07-21 02:12:00 PST ---
Thanks for the patch, and all the digging that went with it!

I'll try to get us onto a newer version of openxml4j, and once the file part
case issue is sorted, then I'll try to apply your patch :)


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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


DO NOT REPLY [Bug 45431] XSSFWorkbook cannot save a macro-enabled Excel (. xlsm)

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=45431


Nick Burch <ni...@torchbox.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO




--- Comment #2 from Nick Burch <ni...@torchbox.com>  2008-07-18 11:24:36 PST ---
We weren't copying the vba stream over into the new file, which wasn't helping

I've updated poi to copy over the vba stream if there is one. However, excel
still refuses to load the file, so I don't know what else we're supposed to do.
Clearly there is a secret hidden reference somewhere that we're not updating or
something

It may be worth closely comparing the un-zipped contents of the pre-poi and
post-poi files, to see if you can spot any important bits that differ


-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

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