public HSSFEvaluationCell(HSSFCell cell) { this(cell, new HSSFEvaluationSheet(cell.getSheet())); } @Override
public HSSFEvaluationCell(HSSFCell cell) { this(cell, new HSSFEvaluationSheet(cell.getSheet())); } public Object getIdentityKey() {
public HSSFEvaluationCell(HSSFCell cell) { this(cell, new HSSFEvaluationSheet(cell.getSheet())); } public Object getIdentityKey() {
public HSSFEvaluationCell(HSSFCell cell) { this(cell, new HSSFEvaluationSheet(cell.getSheet())); } @Override
@Override public void apply() { for (DataObject dataObject : data) { dataObject.resultCell.getSheet().autoSizeColumn(dataObject.resultCell.getColumnIndex()); } } }
@Override public void apply() { for (DataObject dataObject : data) { dataObject.resultCell.getSheet().autoSizeColumn(dataObject.resultCell.getColumnIndex()); } } }
@Override public void apply() { for (DataObject dataObject : data) { HSSFCell resultCell = dataObject.resultCell; HSSFCell templateCell = dataObject.templateCell; String templateCellValue = templateCell.getStringCellValue(); Matcher matcher = pattern.matcher(templateCellValue); if (matcher.find()) { String paramName = matcher.group(1); Integer width = (Integer) dataObject.bandData.getParameterValue(paramName); if (width != null) { resultCell.getSheet().setColumnWidth(resultCell.getColumnIndex(), width); } } } } }
@Override public void apply() { for (DataObject dataObject : data) { HSSFCell resultCell = dataObject.resultCell; HSSFCell templateCell = dataObject.templateCell; String templateCellValue = templateCell.getStringCellValue(); Matcher matcher = pattern.matcher(templateCellValue); if (matcher.find()) { String paramName = matcher.group(1); Integer width = (Integer) dataObject.bandData.getParameterValue(paramName); if (width != null) { resultCell.getSheet().setColumnWidth(resultCell.getColumnIndex(), width); } } } } }
displayNameCell.getSheet().addValidationData(displayNameValidation);
@Override public void inlineToXls(HSSFPatriarch patriarch, HSSFCell resultCell, Object paramValue, Matcher paramsMatcher) { try { Image image = new Image(paramValue, paramsMatcher); if (image.isValid()) { HSSFSheet sheet = resultCell.getSheet(); HSSFWorkbook workbook = sheet.getWorkbook(); int pictureIdx = workbook.addPicture(image.imageContent, Workbook.PICTURE_TYPE_JPEG); CreationHelper helper = workbook.getCreationHelper(); ClientAnchor anchor = helper.createClientAnchor(); anchor.setCol1(resultCell.getColumnIndex()); anchor.setRow1(resultCell.getRowIndex()); anchor.setCol2(resultCell.getColumnIndex()); anchor.setRow2(resultCell.getRowIndex()); if (patriarch == null) { throw new IllegalArgumentException(String.format("No HSSFPatriarch object provided. Charts on this sheet could cause this effect. Please check sheet %s", resultCell.getSheet().getSheetName())); } HSSFPicture picture = patriarch.createPicture(anchor, pictureIdx); Dimension size = ImageUtils.getDimensionFromAnchor(picture); double actualHeight = size.getHeight() / EMU_PER_PIXEL; double actualWidth = size.getWidth() / EMU_PER_PIXEL; picture.resize((double) image.width / actualWidth, (double) image.height / actualHeight); } } catch (IllegalArgumentException e) { throw new ReportFormattingException("An error occurred while inserting bitmap to xls file", e); } }
@Override public void inlineToXls(HSSFPatriarch patriarch, HSSFCell resultCell, Object paramValue, Matcher paramsMatcher) { try { Image image = new Image(paramValue, paramsMatcher); if (image.isValid()) { HSSFSheet sheet = resultCell.getSheet(); HSSFWorkbook workbook = sheet.getWorkbook(); int pictureIdx = workbook.addPicture(image.imageContent, Workbook.PICTURE_TYPE_JPEG); CreationHelper helper = workbook.getCreationHelper(); ClientAnchor anchor = helper.createClientAnchor(); anchor.setCol1(resultCell.getColumnIndex()); anchor.setRow1(resultCell.getRowIndex()); anchor.setCol2(resultCell.getColumnIndex()); anchor.setRow2(resultCell.getRowIndex()); if (patriarch == null) { throw new IllegalArgumentException(String.format("No HSSFPatriarch object provided. Charts on this sheet could cause this effect. Please check sheet %s", resultCell.getSheet().getSheetName())); } HSSFPicture picture = patriarch.createPicture(anchor, pictureIdx); Dimension size = ImageUtils.getDimensionFromAnchor(picture); double actualHeight = size.getHeight() / EMU_PER_PIXEL; double actualWidth = size.getWidth() / EMU_PER_PIXEL; picture.resize((double) image.width / actualWidth, (double) image.height / actualHeight); } } catch (IllegalArgumentException e) { throw new ReportFormattingException("An error occurred while inserting bitmap to xls file", e); } }
if(oldCell.getSheet().getWorkbook() == newCell.getSheet().getWorkbook()){ newCell.setCellStyle(oldCell.getCellStyle()); } else{ HSSFCellStyle newCellStyle = styleMap.get(stHashCode); if(newCellStyle == null){ newCellStyle = newCell.getSheet().getWorkbook().createCellStyle(); newCellStyle.cloneStyleFrom(oldCell.getCellStyle()); styleMap.put(stHashCode, newCellStyle);
drawingPatriarchsMap.get(resultCell.getSheet())); } else { String cellValue = inlineBandDataToCellString(templateCell, templateCellValue, band);
drawingPatriarchsMap.get(resultCell.getSheet())); } else { String cellValue = inlineBandDataToCellString(templateCell, templateCellValue, band);
BandData bandData = dataObject.bandData; HSSFWorkbook resultWorkbook = resultCell.getSheet().getWorkbook(); HSSFWorkbook templateWorkbook = templateCell.getSheet().getWorkbook(); Sheet sheet = resultCell.getSheet(); for (int i = 0; i < sheet.getNumMergedRegions(); i++) { CellRangeAddress mergedRegion = sheet.getMergedRegion(i);
BandData bandData = dataObject.bandData; HSSFWorkbook resultWorkbook = resultCell.getSheet().getWorkbook(); HSSFWorkbook templateWorkbook = templateCell.getSheet().getWorkbook(); Sheet sheet = resultCell.getSheet(); for (int i = 0; i < sheet.getNumMergedRegions(); i++) { CellRangeAddress mergedRegion = sheet.getMergedRegion(i);
private static void copyCellStyle(HSSFCell cell, HSSFCellStyle newCellStyle) { newCellStyle.setAlignment(cell.getCellStyle().getAlignment()); newCellStyle.setBorderBottom(cell.getCellStyle().getBorderBottom()); newCellStyle.setBorderLeft(cell.getCellStyle().getBorderLeft()); newCellStyle.setBorderRight(cell.getCellStyle().getBorderRight()); newCellStyle.setBorderTop(cell.getCellStyle().getBorderTop()); newCellStyle.setBottomBorderColor(cell.getCellStyle().getBottomBorderColor()); newCellStyle.setDataFormat(cell.getCellStyle().getDataFormat()); newCellStyle.setFillBackgroundColor(cell.getCellStyle().getFillBackgroundColor()); newCellStyle.setFillForegroundColor(cell.getCellStyle().getFillForegroundColor()); newCellStyle.setFillPattern(cell.getCellStyle().getFillPattern()); newCellStyle.setFont(cell.getCellStyle().getFont(cell.getSheet().getWorkbook())); newCellStyle.setHidden(cell.getCellStyle().getHidden()); newCellStyle.setIndention(cell.getCellStyle().getIndention()); newCellStyle.setLeftBorderColor(cell.getCellStyle().getLeftBorderColor()); newCellStyle.setLocked(cell.getCellStyle().getLocked()); newCellStyle.setRightBorderColor(cell.getCellStyle().getRightBorderColor()); newCellStyle.setRotation(cell.getCellStyle().getRotation()); newCellStyle.setShrinkToFit(cell.getCellStyle().getShrinkToFit()); newCellStyle.setTopBorderColor(cell.getCellStyle().getTopBorderColor()); // newCellStyle.setUserStyleName(cell.getCellStyle().getUserStyleName()); -> ignore newCellStyle.setVerticalAlignment(cell.getCellStyle().getVerticalAlignment()); newCellStyle.setWrapText(cell.getCellStyle().getWrapText()); }