/** * Gets a boolean value that indicates whether the date systems used in the workbook starts in 1904. * <p> * The default value is false, meaning that the workbook uses the 1900 date system, * where 1/1/1900 is the first day in the system.. * </p> * @return true if the date systems used in the workbook starts in 1904 */ @Internal public boolean isDate1904(){ CTWorkbookPr workbookPr = workbook.getWorkbookPr(); return workbookPr != null && workbookPr.getDate1904(); }
public XlsxSaxAnalyser(AnalysisContext analysisContext) throws IOException, OpenXML4JException, XmlException { this.analysisContext = analysisContext; analysisContext.setCurrentRowNum(0); this.xssfReader = new XSSFReader(OPCPackage.open(analysisContext.getInputStream())); this.sharedStringsTable = this.xssfReader.getSharedStringsTable(); InputStream workbookXml = xssfReader.getWorkbookData(); WorkbookDocument ctWorkbook = WorkbookDocument.Factory.parse(workbookXml); CTWorkbook wb = ctWorkbook.getWorkbook(); CTWorkbookPr prefix = wb.getWorkbookPr(); if (prefix != null) { this.use1904WindowDate = prefix.getDate1904(); } this.analysisContext.setUse1904WindowDate(use1904WindowDate); XSSFReader.SheetIterator ite; sheetSourceList = new ArrayList<SheetSource>(); ite = (XSSFReader.SheetIterator)xssfReader.getSheetsData(); while (ite.hasNext()) { InputStream inputStream = ite.next(); String sheetName = ite.getSheetName(); SheetSource sheetSource = new SheetSource(sheetName, inputStream); sheetSourceList.add(sheetSource); } }
/** * Gets a boolean value that indicates whether the date systems used in the workbook starts in 1904. * <p> * The default value is false, meaning that the workbook uses the 1900 date system, * where 1/1/1900 is the first day in the system.. * </p> * @return true if the date systems used in the workbook starts in 1904 */ protected boolean isDate1904(){ CTWorkbookPr workbookPr = workbook.getWorkbookPr(); return workbookPr != null && workbookPr.getDate1904(); }
/** * Gets a boolean value that indicates whether the date systems used in the workbook starts in 1904. * <p> * The default value is false, meaning that the workbook uses the 1900 date system, * where 1/1/1900 is the first day in the system.. * </p> * @return true if the date systems used in the workbook starts in 1904 */ @Internal public boolean isDate1904(){ CTWorkbookPr workbookPr = workbook.getWorkbookPr(); return workbookPr != null && workbookPr.getDate1904(); }
private Object getV(XLXContext context,Object value) throws IOException { if(value == XLSXErrorValue.INSATNCE){ return "#VALUE!"; } if (value instanceof Money){ return ((Money)value).getValue().doubleValue(); } else if (value instanceof Number){ return value.toString(); }else if (value instanceof Date){ boolean date1904 = workbookPr != null && workbookPr.getDate1904(); return String.valueOf(DateUtil.getExcelDate((Date) value, date1904 )); } else if (value instanceof Link) { return ((Link) value).getLabel(); } if(context.getSst() == null || cell.getCellType() == XSSFCell.CELL_TYPE_FORMULA){ return SST.forXML(value.toString().trim()); }else { return context.getSst().add(value.toString().trim()); } }
this.isDate1904 = wd.getWorkbook().getWorkbookPr().getDate1904();