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 2009/06/26 02:33:44 UTC

DO NOT REPLY [Bug 47432] New: xlsx files generated with POI cannot be opened by OpenOffice 3.x

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

           Summary: xlsx files generated with POI cannot be opened by
                    OpenOffice 3.x
           Product: POI
           Version: 3.5-dev
          Platform: PC
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: XSSF
        AssignedTo: dev@poi.apache.org
        ReportedBy: lnelson@llnl.gov


Created an attachment (id=23884)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23884)
xlsx file generated by POI that cannot be opened by OpenOffice

After creating an xlsx file with the following sample code, and opening it with
OpenOffice 3.x, first it prompts me for the file type, then I choose Microsoft
Office 2007 XML, then I get a "General Error. General input/output error".  

If you open the xlsx file with Excel 2007, then save it, it is then openable by
OpenOffice.  Also, OpenOffice automatically detects the file type, so it opens
immediately.

I did some investigation, and found that after opening/saving the xlsx file
with Excel, the _rels/.rels file is changed (by Excel) to remove the leading
slashes from the Target property of the Relationship tag.  If I take the file
generated by the code below, and manually remove the leading slashes from the
Target entries in the _rels/.rels file, the file is openable by OpenOffice.  

When looking at the ECMA-376 docs, page 67, it shows the Relationship/Target
entries without leading slashes on them.  So I believe POI is creating files
that aren't valid with respect to the Target tag.  Excel seems to be lenient in
reading them, (and removing the badness when re-saving), and OpenOffice is just
failing completely upon trying to parse the files.

I will attach two xlsx files.  One generated by the code below that cannot be
opened by OpenOffice (test-bad.xlsx) and one that has been manually fixed that
can be opened by OpenOffice (test-fixed.xlsx).

I looked into trying to fix POI to remove the leading slashes, but I quickly
ran into some issues with the code in openxml4j which has special checking to
make SURE these entries have leading slashes!    (Line 391 in
org.apache.poi.openxlm4j.opc.PackagePartName.java)

Sample code to generate a workbook.  (Every workbook I have generated with POI
3.5-beta6 cannot be opened by OpenOffice in my testing)

  try {
    XSSFWorkbook wb = new XSSFWorkbook();
    Sheet sheet = wb.createSheet();
    OutputStream out = new FileOutputStream(new File("test-bad.xlsx"));
    wb.write(out);
    out.flush();
    out.close(); 
  } catch (Exception e) {
    e.printStackTrace();
  }



_rels/.rels contents that OpenOffice errors parsing:

<?xml version="1.0" encoding="UTF-8"?>
<Relationships
xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
    <Relationship Id="rId1" Target="/xl/workbook.xml"
Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"/>
    <Relationship Id="rId2" Target="/docProps/core.xml"
Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties"/>
</Relationships>

_rels/.rels contents that makes OpenOffice able to read files (only removed
leading slashes from Target entries):

<?xml version="1.0" encoding="UTF-8"?>
<Relationships
xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
    <Relationship Id="rId1" Target="xl/workbook.xml"
Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"/>
    <Relationship Id="rId2" Target="docProps/core.xml"
Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties"/>
</Relationships>

Thanks,
--Leif

-- 
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 47432] xlsx files generated with POI cannot be opened by OpenOffice 3.x

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





--- Comment #3 from Yegor Kozlov <ye...@dinom.ru>  2009-06-27 04:43:54 PST ---
Leif,

I suggest you vote for this bug on openoffice.org:
http://www.openoffice.org/issues/show_bug.cgi?id=97460

According to their rules, additional vote should prioritize this bug to an
upper level. I hope it will influence OO developers to fix it.

Regards,
Yegor

-- 
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 47432] xlsx files generated with POI cannot be opened by OpenOffice 3.x

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





--- Comment #1 from Leif Nelson <ln...@llnl.gov>  2009-06-25 17:34:17 PST ---
Created an attachment (id=23885)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=23885)
xlsx file that has been "fixed" to be readable by OpenOffice

-- 
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 47432] xlsx files generated with POI cannot be opened by OpenOffice 3.x

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





--- Comment #4 from Leif Nelson <ln...@llnl.gov>  2009-06-29 07:51:48 PST ---
Yegor,

I added as many votes as I could for the OpenOffice issue.

Thanks!
--Leif

-- 
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 47432] xlsx files generated with POI cannot be opened by OpenOffice 3.x

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


Leif Nelson <ln...@llnl.gov> changed:

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




--- Comment #2 from Leif Nelson <ln...@llnl.gov>  2009-06-26 08:14:49 PST ---


*** This bug has been marked as a duplicate of bug 46419 ***

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