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/06/27 13:21:26 UTC

svn commit: r788956 - in /poi/trunk/src: documentation/content/xdocs/status.xml ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java

Author: yegor
Date: Sat Jun 27 11:21:26 2009
New Revision: 788956

URL: http://svn.apache.org/viewvc?rev=788956&view=rev
Log:
Explicitly set the 1900 date system when creating XSSF workbooks, see Bugzilla 47411

Modified:
    poi/trunk/src/documentation/content/xdocs/status.xml
    poi/trunk/src/ooxml/java/org/apache/poi/xssf/usermodel/XSSFWorkbook.java
    poi/trunk/src/ooxml/testcases/org/apache/poi/xssf/usermodel/TestXSSFWorkbook.java

Modified: poi/trunk/src/documentation/content/xdocs/status.xml
URL: http://svn.apache.org/viewvc/poi/trunk/src/documentation/content/xdocs/status.xml?rev=788956&r1=788955&r2=788956&view=diff
==============================================================================
--- poi/trunk/src/documentation/content/xdocs/status.xml (original)
+++ poi/trunk/src/documentation/content/xdocs/status.xml Sat Jun 27 11:21:26 2009
@@ -33,6 +33,7 @@
 
     <changes>
         <release version="3.5-beta7" date="2009-??-??">
+           <action dev="POI-DEVELOPERS" type="fix">47411 - Explicitly set the 1900 date system when creating XSSF workbooks</action>
            <action dev="POI-DEVELOPERS" type="add">47400 - Support fo text extraction of footnotes, endnotes and comments in HWPF</action>
            <action dev="POI-DEVELOPERS" type="fix">47415 - Fixed PageSettingsBlock to allow multiple PLS records</action>
            <action dev="POI-DEVELOPERS" type="fix">47412 - Fixed concurrency issue with EscherProperties.initProps()</action>

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=788956&r1=788955&r2=788956&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 Sat Jun 27 11:21:26 2009
@@ -215,6 +215,11 @@
      */
     private void onWorkbookCreate() {
         workbook = CTWorkbook.Factory.newInstance();
+
+        // don't EVER use the 1904 date system
+        CTWorkbookPr workbookPr = workbook.addNewWorkbookPr();
+        workbookPr.setDate1904(false);
+
         CTBookViews bvs = workbook.addNewBookViews();
         CTBookView bv = bvs.addNewWorkbookView();
         bv.setActiveTab(0);

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=788956&r1=788955&r2=788956&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 Sat Jun 27 11:21:26 2009
@@ -35,6 +35,7 @@
 import org.apache.poi.openxml4j.opc.PackagingURIHelper;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheet;
 import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook;
+import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbookPr;
 
 public final class TestXSSFWorkbook extends BaseTestWorkbook {
 
@@ -49,7 +50,14 @@
 	 */
 	public void testSaveLoadNew() throws Exception {
 		XSSFWorkbook workbook = new XSSFWorkbook();
-		Sheet sheet1 = workbook.createSheet("sheet1");
+
+        //check that the default date system is set to 1900
+        CTWorkbookPr pr = workbook.getCTWorkbook().getWorkbookPr();
+        assertNotNull(pr);
+        assertTrue(pr.isSetDate1904());
+        assertFalse("XSSF must use the 1900 date system", pr.getDate1904());
+
+        Sheet sheet1 = workbook.createSheet("sheet1");
 		Sheet sheet2 = workbook.createSheet("sheet2");
 		workbook.createSheet("sheet3");
 		



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