Explicitly set the 1900 date system when creating XSSF workbooks, see Bugzilla 47411
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@788956 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
12806cceaa
commit
efc5431030
@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
<changes>
|
<changes>
|
||||||
<release version="3.5-beta7" date="2009-??-??">
|
<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="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">47415 - Fixed PageSettingsBlock to allow multiple PLS records</action>
|
||||||
<action dev="POI-DEVELOPERS" type="fix">47412 - Fixed concurrency issue with EscherProperties.initProps()</action>
|
<action dev="POI-DEVELOPERS" type="fix">47412 - Fixed concurrency issue with EscherProperties.initProps()</action>
|
||||||
|
@ -215,6 +215,11 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Iterable<X
|
|||||||
*/
|
*/
|
||||||
private void onWorkbookCreate() {
|
private void onWorkbookCreate() {
|
||||||
workbook = CTWorkbook.Factory.newInstance();
|
workbook = CTWorkbook.Factory.newInstance();
|
||||||
|
|
||||||
|
// don't EVER use the 1904 date system
|
||||||
|
CTWorkbookPr workbookPr = workbook.addNewWorkbookPr();
|
||||||
|
workbookPr.setDate1904(false);
|
||||||
|
|
||||||
CTBookViews bvs = workbook.addNewBookViews();
|
CTBookViews bvs = workbook.addNewBookViews();
|
||||||
CTBookView bv = bvs.addNewWorkbookView();
|
CTBookView bv = bvs.addNewWorkbookView();
|
||||||
bv.setActiveTab(0);
|
bv.setActiveTab(0);
|
||||||
|
@ -35,6 +35,7 @@ import org.apache.poi.openxml4j.opc.PackagePart;
|
|||||||
import org.apache.poi.openxml4j.opc.PackagingURIHelper;
|
import org.apache.poi.openxml4j.opc.PackagingURIHelper;
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheet;
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheet;
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook;
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook;
|
||||||
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbookPr;
|
||||||
|
|
||||||
public final class TestXSSFWorkbook extends BaseTestWorkbook {
|
public final class TestXSSFWorkbook extends BaseTestWorkbook {
|
||||||
|
|
||||||
@ -49,7 +50,14 @@ public final class TestXSSFWorkbook extends BaseTestWorkbook {
|
|||||||
*/
|
*/
|
||||||
public void testSaveLoadNew() throws Exception {
|
public void testSaveLoadNew() throws Exception {
|
||||||
XSSFWorkbook workbook = new XSSFWorkbook();
|
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");
|
Sheet sheet2 = workbook.createSheet("sheet2");
|
||||||
workbook.createSheet("sheet3");
|
workbook.createSheet("sheet3");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user