You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by ye...@apache.org on 2009/08/09 15:08:59 UTC

svn commit: r802539 - in /poi/trunk/src: documentation/content/xdocs/spreadsheet/ ooxml/java/org/apache/poi/ ooxml/java/org/apache/poi/xssf/usermodel/ ooxml/java/org/apache/poi/xwpf/usermodel/ ooxml/testcases/org/apache/poi/xssf/usermodel/ ooxml/testca...

Author: yegor
Date: Sun Aug  9 13:08:59 2009
New Revision: 802539

URL: http://svn.apache.org/viewvc?rev=802539&view=rev
Log:
removed temporary fix for compatibility with Mac Excel 2008 Sp2

Modified:
    poi/trunk/src/documentation/content/xdocs/spreadsheet/index.xml
    poi/trunk/src/ooxml/java/org/apache/poi/POIXMLDocument.java
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
    poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/TestXWPFDocument.java

Modified: poi/trunk/src/documentation/content/xdocs/spreadsheet/index.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/spreadsheet/index.xml?rev=802539&r1=802538&r2=802539&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/spreadsheet/index.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/spreadsheet/index.xml Sun Aug  9 13:08:59 2009
@@ -74,36 +74,5 @@
         older HSSF supported (.xls) binary files.
             </p>
         </section>
-        <section>
-          <title>Compatibility of POI-generated .xlsx files with MS Office 2008 for Mac SP2</title>
-          <p>
-            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 <link href="https://issues.apache.org/bugzilla/show_bug.cgi?id=47559">Bugzilla 47559</link> for more information.
-          </p>
-          <p>
-            Users are advised to patch existing .xlsx files by the following code:
-          </p>
-          <source>
-  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(); 
-        </source>  
-        <p>To unset the Application property use the following code:</p>
-        <source>  
-  POIXMLProperties.ExtendedProperties ext = workbook.getProperties().getExtendedProperties();
-  expProps.getUnderlyingProperties().unsetApplication();
-        </source>  
-          <warning>
-            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".  
-        </warning>
-        </section>
     </body>
 </document>

Modified: poi/trunk/src/ooxml/java/org/apache/poi/POIXMLDocument.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/POIXMLDocument.java?rev=802539&r1=802538&r2=802539&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/POIXMLDocument.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/POIXMLDocument.java Sun Aug  9 13:08:59 2009
@@ -28,6 +28,7 @@
 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";

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java?rev=802539&r1=802538&r2=802539&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java Sun Aug  9 13:08:59 2009
@@ -229,9 +229,8 @@
         bv.setActiveTab(0);
         workbook.addNewSheets();
 
-        //required by Excel 2008 Mac sp2, see Bugzilla #47559
         POIXMLProperties.ExtendedProperties expProps = getProperties().getExtendedProperties();
-        expProps.getUnderlyingProperties().setApplication("Microsoft Excel");
+        expProps.getUnderlyingProperties().setApplication(DOCUMENT_CREATOR);
 
         sharedStringSource = (SharedStringsTable)createRelationship(XSSFRelation.SHARED_STRINGS, XSSFFactory.getInstance());
         stylesSource = (StylesTable)createRelationship(XSSFRelation.STYLES, XSSFFactory.getInstance());
@@ -253,7 +252,7 @@
             // Create main document part
             pkg.createPart(corePartName, XSSFRelation.WORKBOOK.getContentType());
 
-            pkg.getPackageProperties().setCreatorProperty("Apache POI");
+            pkg.getPackageProperties().setCreatorProperty(DOCUMENT_CREATOR);
 
             return pkg;
         } catch (Exception e){

Modified: poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java?rev=802539&r1=802538&r2=802539&view=diff
==============================================================================
--- poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java (original)
+++ poi/trunk/src/ooxml/java/org/apache/poi/xwpf/usermodel/XWPFDocument.java Sun Aug  9 13:08:59 2009
@@ -169,7 +169,7 @@
             // Create main document part
             pkg.createPart(corePartName, XWPFRelation.DOCUMENT.getContentType());
 
-            pkg.getPackageProperties().setCreatorProperty("Apache POI");
+            pkg.getPackageProperties().setCreatorProperty(DOCUMENT_CREATOR);
 
             return pkg;
         } catch (Exception e){
@@ -190,7 +190,7 @@
         ctDocument.addNewBody();
 
         POIXMLProperties.ExtendedProperties expProps = getProperties().getExtendedProperties();
-        expProps.getUnderlyingProperties().setApplication("Microsoft Office Word");
+        expProps.getUnderlyingProperties().setApplication(DOCUMENT_CREATOR);
     }
 
     /**

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java?rev=802539&r1=802538&r2=802539&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java Sun Aug  9 13:08:59 2009
@@ -261,7 +261,7 @@
         POIXMLProperties props = workbook.getProperties();
         assertNotNull(props);
         //the Application property must be set for new workbooks, see Bugzilla #47559
-        assertEquals("Microsoft Excel", props.getExtendedProperties().getUnderlyingProperties().getApplication());
+        assertEquals("Apache POI", props.getExtendedProperties().getUnderlyingProperties().getApplication());
 
         PackagePropertiesPart opcProps = props.getCoreProperties().getUnderlyingProperties();
         assertNotNull(opcProps);
@@ -271,7 +271,7 @@
         opcProps.setCreatorProperty("poi-dev@poi.apache.org");
 
         workbook = XSSFTestDataSamples.writeOutAndReadBack(workbook);
-        assertEquals("Microsoft Excel", workbook.getProperties().getExtendedProperties().getUnderlyingProperties().getApplication());
+        assertEquals("Apache POI", workbook.getProperties().getExtendedProperties().getUnderlyingProperties().getApplication());
         opcProps = workbook.getProperties().getCoreProperties().getUnderlyingProperties();
         assertEquals("Testing Bugzilla #47460", opcProps.getTitleProperty().getValue());
         assertEquals("poi-dev@poi.apache.org", opcProps.getCreatorProperty().getValue());

Modified: poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/TestXWPFDocument.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/TestXWPFDocument.java?rev=802539&r1=802538&r2=802539&view=diff
==============================================================================
--- poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/TestXWPFDocument.java (original)
+++ poi/trunk/src/ooxml/testcases/org/apache/poi/xwpf/TestXWPFDocument.java Sun Aug  9 13:08:59 2009
@@ -125,7 +125,7 @@
         XWPFDocument doc = new XWPFDocument();
         POIXMLProperties props = doc.getProperties();
         assertNotNull(props);
-        assertEquals("Microsoft Office Word", props.getExtendedProperties().getUnderlyingProperties().getApplication());
+        assertEquals("Apache POI", props.getExtendedProperties().getUnderlyingProperties().getApplication());
     }
 
 }



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