/** * Import the model according to reversed dependency order among model objects: book, sheet, * defined name, cells, chart, pictures, validation. */ @Override public SBook imports(InputStream is, String bookName) throws IOException { // clear cache for reuse importedStyle.clear(); importedFont.clear(); workbook = createPoiBook(is); book = SBooks.createBook(bookName); // book.setDefaultCellStyle(importCellStyle(workbook.getCellStyleAt((short) 0), false)); // //ZSS-780 // ZSS-854 importDefaultCellStyles(); importNamedStyles(); // ZSS-1140 importExtraStyles(); setBookType(book); // ZSS-715: Enforce internal Locale.US Locale so formula is in consistent internal format Locale old = Locales.setThreadLocal(Locale.US); SBookSeries bookSeries = book.getBookSeries(); boolean isCacheClean = bookSeries.isAutoFormulaCacheClean(); try { bookSeries.setAutoFormulaCacheClean(false); // disable it to avoid // unnecessary clean up // during importing importExternalBookLinks(); int numberOfSheet = workbook.getNumberOfSheets(); for (int i = 0; i < numberOfSheet; i++) { Sheet poiSheet = workbook.getSheetAt(i); importSheet(poiSheet, i); SSheet sheet = book.getSheet(i); importTables(poiSheet, sheet); // ZSS-855, ZSS-1011 } importNamedRange(); for (int i = 0; i < numberOfSheet; i++) { SSheet sheet = book.getSheet(i); Sheet poiSheet = workbook.getSheetAt(i); for (Row poiRow : poiSheet) { importRow(poiRow, sheet); } importColumn(poiSheet, sheet); importMergedRegions(poiSheet, sheet); importDrawings(poiSheet, sheet); importValidation(poiSheet, sheet); importAutoFilter(poiSheet, sheet); importSheetProtection(poiSheet, sheet); // ZSS-576 } } finally { book.getBookSeries().setAutoFormulaCacheClean(isCacheClean); Locales.setThreadLocal(old); } return book; }