From 58f32a32b545ae8075fb47f43ce0b5505e167075 Mon Sep 17 00:00:00 2001 From: Yegor Kozlov Date: Sun, 9 Aug 2009 13:08:59 +0000 Subject: [PATCH] removed temporary fix for compatibility with Mac Excel 2008 Sp2 git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@802539 13f79535-47bb-0310-9956-ffa450edef68 --- .../content/xdocs/spreadsheet/index.xml | 31 ------------------- .../java/org/apache/poi/POIXMLDocument.java | 1 + .../poi/xssf/usermodel/XSSFWorkbook.java | 5 ++- .../poi/xwpf/usermodel/XWPFDocument.java | 4 +-- .../poi/xssf/usermodel/TestXSSFWorkbook.java | 4 +-- .../org/apache/poi/xwpf/TestXWPFDocument.java | 2 +- 6 files changed, 8 insertions(+), 39 deletions(-) diff --git a/src/documentation/content/xdocs/spreadsheet/index.xml b/src/documentation/content/xdocs/spreadsheet/index.xml index a9f025e4e2..f52d60c3dd 100644 --- a/src/documentation/content/xdocs/spreadsheet/index.xml +++ b/src/documentation/content/xdocs/spreadsheet/index.xml @@ -74,36 +74,5 @@ older HSSF supported (.xls) binary files.

-
- Compatibility of POI-generated .xlsx files with MS Office 2008 for Mac SP2 -

- Office 2008 for Mac SP2 version 12.2.0 introduced a serious bug causing some Open XML files to fail to open. - This bug is affecting Open XML files from a variety of sources including the Apache POI project. - The Apache POI project adjusted the XSSF module to produce "MS-compatible OOXML" by setting the Application extended property to "Microsoft Excel". This will allow users to produce OOXML documents that will work with Office 2008 for Mac SP2. - Please see Bugzilla 47559 for more information. -

-

- Users are advised to patch existing .xlsx files by the following code: -

- - XSSFWorkbook wb = new XSSFWorkbook(path); - - POIXMLProperties.ExtendedProperties ext = wb.getProperties().getExtendedProperties(); - expProps.getUnderlyingProperties().setApplication("Microsoft Excel"); - - FileOutputStream out = new FileOutputStream(path); - wb.write(out); - out.close(); - -

To unset the Application property use the following code:

- - POIXMLProperties.ExtendedProperties ext = workbook.getProperties().getExtendedProperties(); - expProps.getUnderlyingProperties().unsetApplication(); - - - This is an effective workaround for a short-term bug which is likely to be removed in future versions of POI, - when Microsoft returns to compliance with the standard. The proper value for Apache POI created documents would to be "Apache POI" and not "Microsoft Excel". - -
diff --git a/src/ooxml/java/org/apache/poi/POIXMLDocument.java b/src/ooxml/java/org/apache/poi/POIXMLDocument.java index ace5d01986..1f0d907080 100644 --- a/src/ooxml/java/org/apache/poi/POIXMLDocument.java +++ b/src/ooxml/java/org/apache/poi/POIXMLDocument.java @@ -28,6 +28,7 @@ import org.apache.poi.openxml4j.exceptions.OpenXML4JException; import org.apache.poi.openxml4j.opc.*; public abstract class POIXMLDocument extends POIXMLDocumentPart{ + public static final String DOCUMENT_CREATOR = "Apache POI"; public static final String CORE_PROPERTIES_REL_TYPE = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties"; public static final String EXTENDED_PROPERTIES_REL_TYPE = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties"; diff --git a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java index d08cbc5eea..15ddd8f127 100644 --- a/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java +++ b/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java @@ -229,9 +229,8 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Iterable