org.openxmlformats.schemas.spreadsheetml.x2006.main.WorkbookDocument Java Examples
The following examples show how to use
org.openxmlformats.schemas.spreadsheetml.x2006.main.WorkbookDocument.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XlsxSaxAnalyser.java From easyexcel with Apache License 2.0 | 5 votes |
private void analysisUse1904WindowDate(XSSFReader xssfReader, XlsxReadWorkbookHolder xlsxReadWorkbookHolder) throws Exception { if (xlsxReadWorkbookHolder.globalConfiguration().getUse1904windowing() != null) { return; } InputStream workbookXml = xssfReader.getWorkbookData(); WorkbookDocument ctWorkbook = WorkbookDocument.Factory.parse(workbookXml); CTWorkbook wb = ctWorkbook.getWorkbook(); CTWorkbookPr prefix = wb.getWorkbookPr(); if (prefix != null && prefix.getDate1904()) { xlsxReadWorkbookHolder.getGlobalConfiguration().setUse1904windowing(Boolean.TRUE); } else { xlsxReadWorkbookHolder.getGlobalConfiguration().setUse1904windowing(Boolean.FALSE); } }
Example #2
Source File: SpreadsheetUtils.java From CloverETL-Engine with GNU Lesser General Public License v2.1 | 5 votes |
/** * Checks the source for 1904 windowing flag. This is kind of ugly, but there doesn't seem to be a better way. * Method for event model. * @param reader * @return true if 1904 windowing is used, false otherwise * @throws IOException * @throws XmlException * @throws InvalidFormatException */ public static boolean get1904Windowing(XSSFReader reader) throws IOException, XmlException, InvalidFormatException { InputStream workbookXML = reader.getWorkbookData(); WorkbookDocument doc = WorkbookDocument.Factory.parse(workbookXML); CTWorkbookPr workbookPr = doc.getWorkbook().getWorkbookPr(); boolean windowing1904 = false; if (workbookPr != null) { windowing1904 = workbookPr.getDate1904(); } workbookXML.close(); return windowing1904; }