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 2014/10/29 11:15:20 UTC

[Bug 57162] New: Could not open macro enabled xlsm file after writing using POI3.11beta2 version.

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

            Bug ID: 57162
           Summary: Could not open macro enabled xlsm file after writing
                    using POI3.11beta2 version.
           Product: POI
           Version: 3.11-dev
          Hardware: PC
            Status: NEW
          Severity: blocker
          Priority: P2
         Component: OPC
          Assignee: dev@poi.apache.org
          Reporter: rmishra@ptc.com

Created attachment 32162
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=32162&action=edit
Error when opening exported xlsm file

Hi,

I am using poi3.11beta2 version to write a macro enabled .xlsm file.There is no
error/exception during writing the  while. After successful exception when I
try to open the exported xlsm file It is is giving below error.

It was working fine with poi3.9 version.The issue is occurring after upgrading
it to poi3.11beta2 version.

Thanks in advance.

Regards,
Ranjay Mishra

-- 
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


[Bug 57162] Could not open macro enabled xlsm file after writing using POI3.11beta2 version.

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

Andreas Beeker <an...@gmx.de> changed:

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

--- Comment #7 from Andreas Beeker <an...@gmx.de> ---
I can't reproduce it with the trunk, an arbitrary .xlsx and your sample code.
Please add your .xlsx and the exact code.
I guess this happens because of the marshalling changes in
StreamHelper.saveXmlInStream.

-- 
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


[Bug 57162] Could not open macro enabled xlsm file after writing using POI3.11beta2 version.

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

--- Comment #15 from Uwe Schindler (ASF) <uw...@thetaphi.de> ---
I verified the example, works now. I checked Content_Types.xml and .rels file,
both have correct namespaces (and same content as provided file).

So I think the attached patch fixes the bug. I will commit it later today.

-- 
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


[Bug 57162] Could not open macro enabled xlsm file after writing using POI3.11beta2 version.

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

--- Comment #8 from Ranjay Mishra <rm...@ptc.com> ---
Created attachment 32178
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=32178&action=edit
Sample xlsm file

-- 
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


[Bug 57162] Could not open macro enabled xlsm file after writing using POI3.11beta2 version.

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

--- Comment #14 from Uwe Schindler (ASF) <uw...@thetaphi.de> ---
I verified, the relationships file ".rels" was also broken in your provided
file. So the issue that is fixed by my patch is also fixed there.

Can you apply the patch to the source package of POI, compile the JARs and try
again?

Uwe

-- 
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


[Bug 57162] Could not open macro enabled xlsm file after writing using POI3.11beta2 version.

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

--- Comment #4 from Ranjay Mishra <rm...@ptc.com> ---
Created attachment 32166
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=32166&action=edit
[Content_type].xml of not working xlsm file

-- 
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


[Bug 57162] Could not open macro enabled xlsm file after writing using POI3.11beta2 version.

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

--- Comment #2 from Ranjay Mishra <rm...@ptc.com> ---
There is no changes in file. Using the same xlsm file in both the cases  and 
code is also same.Here is the xlsm  related code for  creating workbook.

String filePath="c:\\test\\bomTableTemplate.xlsm"
OPCPackage pkg = OPCPackage.open(new File(filePath));
XSSFWorkbook wbTemplate = new XSSFWorkbook(pkg);

SXSSFWorkbook sxWb = new SXSSFWorkbook(wbTemplate);
sxWb.setCompressTempFiles(true);
Workbook wb=sxWb;

Note: there is no issue with xls and xlsx file export.

-- 
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


[Bug 57162] Could not open macro enabled xlsm file after writing using POI3.11beta2 version.

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

Ranjay Mishra <rm...@ptc.com> changed:

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

-- 
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


[Bug 57162] Could not open macro enabled xlsm file after writing using POI3.11beta2 version.

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

--- Comment #12 from Uwe Schindler (ASF) <uw...@thetaphi.de> ---
Created attachment 32180
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=32180&action=edit
Patch that fixes (hoepfully) all missing namespaces

This patch should fix the problem with the ContentTypes file. I also found
another problem with relationships.

The main issue was: The parant element was correctly created with
createElementNS(), but the childs where created without namespace using
createElement().

I fixed this, can somebody verify this (I have no time at the moment).

If POI would use the forbidden-apis Maven/ant plugin, we could forbid to use
createElement (without * NS). I will later look into the remaining code of
OOXML to find other violations (just search for calls to
Document#createElement).

-- 
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


[Bug 57162] Could not open macro enabled xlsm file after writing using POI3.11beta2 version.

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

Ranjay Mishra <rm...@ptc.com> changed:

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

--- Comment #9 from Ranjay Mishra <rm...@ptc.com> ---
Hi,
I have attached sample xlsm file(before export). Please see below  for exact
code.
The same piece of code is working if I use only below 4  jars  along with
jre1.7
poi.jar, poi-ooxml.jar, poi-ooxlm-schema.jar and  xmlbean2.6.0.jar for
standalone project.

But when I use the same code with all above 4 jars along with other jar in
build path which ever was earlier , then it stop working.
After  comparing the generated xlsm file I found content-type is corrupt.

Please note that same xlsm file , same code was working with same jars in build
path  with poi3.9. 

If this is  happens because of the marshalling changes in
StreamHelper.saveXmlInStream could you please let me know the work around or
fix for that. I am also attaching the generated xlsm file(the corrupt file).

CODE Used
----------

 Workbook wb;
 OPCPackage pkg =
OPCPackage.open("D:\\Users\\rmishra\\Desktop\\sample_template.xlsm");
 XSSFWorkbook workbook=new XSSFWorkbook(pkg);
 SXSSFWorkbook sxWb = new SXSSFWorkbook(workbook);
 sxWb.setCompressTempFiles(false);
 FileOutputStream out = new
FileOutputStream("D:\\DescribeLink\\sample_template.xlsm");
 wb = sxWb;
 sxWb.write(out);
 out.close();

-- 
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


[Bug 57162] Could not open macro enabled xlsm file after writing using POI3.11beta2 version.

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

--- Comment #13 from Uwe Schindler (ASF) <uw...@thetaphi.de> ---
This was caused by #56814. Unfortunately, no test is failing because of this
(the reason for this is that POI can read the file also with wrong namespaces,
because the parser is very lenient...).

-- 
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


[Bug 57162] Could not open macro enabled xlsm file after writing using POI3.11beta2 version.

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

--- Comment #11 from Uwe Schindler (ASF) <uw...@thetaphi.de> ---
> I guess this happens because of the marshalling changes in StreamHelper.saveXmlInStream.

I don't think this is the case. The difference in the Content-Types files is
caused by a broken namespace in the elements contained in the root element. The
DOM tree that is serialized is missing the correct namespace, so it get
overwritten with "" (empty namespace).

It looks like the code that creates the DOM tree for the content-types file is
missing to attach the correct namespace to some elements.

Could it be that this is fixed already in trunk?

-- 
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


[Bug 57162] Could not open macro enabled xlsm file after writing using POI3.11beta2 version.

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

--- Comment #16 from Uwe Schindler (ASF) <uw...@thetaphi.de> ---
File also opens with Excel after applying the fix.

-- 
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


[Bug 57162] Could not open macro enabled xlsm file after writing using POI3.11beta2 version.

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

Ranjay Mishra <rm...@ptc.com> changed:

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

--- Comment #6 from Ranjay Mishra <rm...@ptc.com> ---
Hi Nick,
I compared both working and not working xlsm file and found that contents are
same , workbook.xml is same.

Only different I saw if [Content_Type].xml
I have attached both the content type. Could you please have a look and let me
know what  making  content_type.xml to be different and the solution for the
same.

Thanks, 
Ranjay Mishra

-- 
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


[Bug 57162] Could not open macro enabled xlsm file after writing using POI3.11beta2 version.

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

--- Comment #5 from Ranjay Mishra <rm...@ptc.com> ---
Created attachment 32167
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=32167&action=edit
[Content_type].xml of  working xlsm file

-- 
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


[Bug 57162] Could not open macro enabled xlsm file after writing using POI3.11beta2 version.

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

--- Comment #10 from Ranjay Mishra <rm...@ptc.com> ---
Created attachment 32179
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=32179&action=edit
Exported xlsm file , which is not working

-- 
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


[Bug 57162] Could not open macro enabled xlsm file after writing using POI3.11beta2 version.

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

Nick Burch <ap...@gagravarr.org> changed:

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

--- Comment #3 from Nick Burch <ap...@gagravarr.org> ---
There clearly is a difference in the written files, otherwise Excel wouldn't
have started complaining!

You'll need to unzip the two .xlsx files, and compare files present and the xml
in them

-- 
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


[Bug 57162] Could not open macro enabled xlsm file after writing using POI3.11beta2 version.

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

Uwe Schindler (ASF) <uw...@thetaphi.de> changed:

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

--- Comment #17 from Uwe Schindler (ASF) <uw...@thetaphi.de> ---
I fixed this in http://svn.apache.org/r1636188

If you want to try out the fix, you may use a nightly snapshot, once it is
built:
https://builds.apache.org/job/POI/lastSuccessfulBuild/artifact/build/dist/

-- 
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


[Bug 57162] Could not open macro enabled xlsm file after writing using POI3.11beta2 version.

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

--- Comment #18 from Ranjay Mishra <rm...@ptc.com> ---
Thanks a lot!! I verifier with the latest jar distribution.
Issue is resolved now.

-- 
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


[Bug 57162] Could not open macro enabled xlsm file after writing using POI3.11beta2 version.

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

Nick Burch <ap...@gagravarr.org> changed:

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

--- Comment #1 from Nick Burch <ap...@gagravarr.org> ---
How do the files differ when written from the two versions of POI?

-- 
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