@Override public Hyperlink createHyperlink(HyperlinkType type) { return helper.createHyperlink(type); } @Override
protected AbstractCellRangeDataSource(XSSFSheet sheet, CellRangeAddress cellRangeAddress) { this.sheet = sheet; // Make copy since CellRangeAddress is mutable. this.cellRangeAddress = cellRangeAddress.copy(); this.numOfCells = this.cellRangeAddress.getNumberOfCells(); this.evaluator = sheet.getWorkbook().getCreationHelper().createFormulaEvaluator(); }
@Override public DataFormat createDataFormat() { return helper.createDataFormat(); } @Override
/** * Returns an object that handles instantiating concrete * classes of the various instances for XSSF. */ @Override public XSSFCreationHelper getCreationHelper() { if(_creationHelper == null) { _creationHelper = new XSSFCreationHelper(this); } return _creationHelper; }
@Override public void setWritableCell(TableModel tableModel, XSSFCell cell, Object value, int row, int col) { XSSFWorkbook wb = cell.getSheet().getWorkbook(); cell.setCellStyle(cellStyle); cell.setCellValue(wb.getCreationHelper().createRichTextString(value.toString())); cell.setCellType(XSSFCell.CELL_TYPE_STRING); } }
@Override public ExtendedColor createExtendedColor() { return helper.createExtendedColor(); } @Override
@Override public ClientAnchor createClientAnchor() { return helper.createClientAnchor(); }
/** * Should only be called by {@link SXSSFWorkbook#getCreationHelper()} * * @param workbook the workbook to create objects for */ @Internal public SXSSFCreationHelper(SXSSFWorkbook workbook) { this.helper = new XSSFCreationHelper(workbook.getXSSFWorkbook()); this.wb = workbook; }
cell.setCellType(XSSFCell.CELL_TYPE_NUMERIC); } else if (d instanceof Boolean) { cell.setCellValue(createHelper.createRichTextString((Boolean) d ? StaticWidgetHelper.getSynaptixWidgetConstantsBundle().printTrue() : StaticWidgetHelper.getSynaptixWidgetConstantsBundle() .printFalse())); cell.setCellStyle(styleMap.get(IHierarchicalExportWriter.Type.TEXT)); cell.setCellType(XSSFCell.CELL_TYPE_STRING); } else if (d instanceof String) { cell.setCellValue(createHelper.createRichTextString((String) d)); cell.setCellStyle(styleMap.get(IHierarchicalExportWriter.Type.TEXT)); cell.setCellType(XSSFCell.CELL_TYPE_STRING); text = getString(d, objectsToStringByClassMap); cell.setCellValue(createHelper.createRichTextString(text)); cell.setCellStyle(styleMap.get(IHierarchicalExportWriter.Type.TEXT)); cell.setCellType(XSSFCell.CELL_TYPE_STRING);
@Override public ExtendedColor createExtendedColor() { return helper.createExtendedColor(); } @Override
@Override public ClientAnchor createClientAnchor() { return helper.createClientAnchor(); }
@Override public void applyStyleAndValue(int dbColNum, ResultSet resultSet, Cell cell) throws SQLException { if (links < MAX_HYPERLINKS) { Hyperlink hyperlink = workbook.getCreationHelper().createHyperlink(linkType); String path = resultSet.getString(dbColNum); String address = urlBase+path; hyperlink.setAddress(address); cell.setHyperlink(hyperlink); cell.setCellStyle(style); String fName = Paths.get(path).getFileName().toString(); cell.setCellValue(fName); links++; } else { //silently stop adding hyperlinks } } }
/** * Constructs ExcellDataObjectAdaptor object Collection = an Excel work book * sheet * * @param dataFilePath path to an Excel file * @param sheetName sheet name * @throws DataException if file not found */ public ExcelDataObjectAdaptor(String dataFilePath, String sheetName) throws DataException { File file = FileUtils.getFile(dataFilePath + ".xlsx"); if (null == file) { throw new FileNotFoundException(format("Could not find data file: '%s'", dataFilePath)); } this.dataFileName = file.getName().replace(".xlsx", ""); try { this.workBook = new XSSFWorkbook(file); } catch (IOException | InvalidFormatException ex) { throw new DataParseException("Could not parse \"" + file + "\"", ex); } this.sheetName = sheetName; this.basicObj = parseCollection(); this.evaluator = workBook.getCreationHelper().createFormulaEvaluator(); }
@Override public void reset(XSSFWorkbook workbook) { style = workbook.createCellStyle(); style.setDataFormat(workbook.getCreationHelper() .createDataFormat().getFormat(formatString)); }
/** * Returns an object that handles instantiating concrete * classes of the various instances for XSSF. */ @Override public XSSFCreationHelper getCreationHelper() { if(_creationHelper == null) { _creationHelper = new XSSFCreationHelper(this); } return _creationHelper; }
@Override public void setWritableCell(TableModel tableModel, XSSFCell cell, Object value, int row, int col) { XSSFWorkbook wb = cell.getSheet().getWorkbook(); cell.setCellStyle(cellStyle); cell.setCellValue(wb.getCreationHelper().createRichTextString(getString(tableModel, value, row, col))); cell.setCellType(XSSFCell.CELL_TYPE_STRING); }
@Override public Hyperlink createHyperlink(HyperlinkType type) { return helper.createHyperlink(type); } @Override
/** * Constructs ExcelDataProvider object Collection = an Excel work book * sheet * * @param dataFilePath path to an Excel file * @param collectionName sheet name * @throws DataException if file not found */ public ExcelDataProvider(String dataFilePath, String collectionName) throws DataException { File file = FileUtils.getFile(dataFilePath + "." + DEFAULT_EXTENSION); if (null == file) { throw new FileNotFoundException(format("Could not find data file: '%s'", dataFilePath)); } this.dataFileName = file.getName().replace(DEFAULT_EXTENSION, ""); try { this.workBook = new XSSFWorkbook(file); } catch (IOException | InvalidFormatException ex) { throw new DataParseException("Could not parse \"" + file + "\"", ex); } this.collectionName = collectionName; this.basicObject = parseCollection(); this.evaluator = workBook.getCreationHelper().createFormulaEvaluator(); }
@Override public DataFormat createDataFormat() { return helper.createDataFormat(); } @Override
/** * Returns an object that handles instantiating concrete * classes of the various instances for XSSF. */ public XSSFCreationHelper getCreationHelper() { if(_creationHelper == null) _creationHelper = new XSSFCreationHelper(this); return _creationHelper; }