public void setProperty(Row row, int column) { // create cell if it does not exist Cell cell = CellUtil.getCell(row, column); CellUtil.setCellStyleProperty(cell, _propertyName, _propertyValue); } }
/** * Creates a cell, gives it a value, and applies a style if provided * * @param row the row to create the cell in * @param column the column index to create the cell in * @param value The value of the cell * @param style If the style is not null, then set * @return A new Cell */ public static Cell createCell(Row row, int column, String value, CellStyle style) { Cell cell = getCell(row, column); cell.setCellValue(cell.getRow().getSheet().getWorkbook().getCreationHelper() .createRichTextString(value)); if (style != null) { cell.setCellStyle(style); } return cell; }
/** * Applies the drawn borders to a Sheet. The borders that are applied are * the ones that have been drawn by the {@link #drawBorders} and * {@link #drawBorderColors} methods. * * @param sheet * - {@link Sheet} on which to apply borders */ public void applyBorders(Sheet sheet) { Workbook wb = sheet.getWorkbook(); for (Map.Entry<CellAddress, Map<String, Object>> entry : _propertyTemplate .entrySet()) { CellAddress cellAddress = entry.getKey(); if (cellAddress.getRow() < wb.getSpreadsheetVersion().getMaxRows() && cellAddress.getColumn() < wb.getSpreadsheetVersion() .getMaxColumns()) { Map<String, Object> properties = entry.getValue(); Row row = CellUtil.getRow(cellAddress.getRow(), sheet); Cell cell = CellUtil.getCell(row, cellAddress.getColumn()); CellUtil.setCellStyleProperties(cell, properties); } } }
/** * Get a specific cell from a row. If the cell doesn't exist, * then create it. * *@param row The row that the cell is part of *@param columnIndex The column index that the cell is in. *@return The cell indicated by the column. */ public static HSSFCell getCell(HSSFRow row, int columnIndex) { return (HSSFCell) CellUtil.getCell(row, columnIndex); }
/** * Get a specific cell from a row. If the cell doesn't exist, * then create it. * *@param row The row that the cell is part of *@param columnIndex The column index that the cell is in. *@return The cell indicated by the column. */ public static HSSFCell getCell(HSSFRow row, int columnIndex) { return (HSSFCell) CellUtil.getCell(row, columnIndex); }
public void setProperty(Row row, int column) { // create cell if it does not exist Cell cell = CellUtil.getCell(row, column); CellUtil.setCellStyleProperty(cell, _propertyName, _propertyValue); } }
public void setProperty(Row row, int column) { Cell cell = CellUtil.getCell(row, column); CellUtil.setCellStyleProperty(cell, _workbook, _propertyName, _propertyValue); } }
public void setProperty(Row row, int column) { Cell cell = CellUtil.getCell(row, column); CellUtil.setCellStyleProperty(cell, _workbook, _propertyName, _propertyValue); } }
/** * Creates a cell, gives it a value, and applies a style if provided * * @param row the row to create the cell in * @param column the column index to create the cell in * @param value The value of the cell * @param style If the style is not null, then set * @return A new Cell */ public static Cell createCell(Row row, int column, String value, CellStyle style) { Cell cell = getCell(row, column); cell.setCellValue(cell.getRow().getSheet().getWorkbook().getCreationHelper() .createRichTextString(value)); if (style != null) { cell.setCellStyle(style); } return cell; }
/** * Creates a cell, gives it a value, and applies a style if provided * * @param row the row to create the cell in * @param column the column index to create the cell in * @param value The value of the cell * @param style If the style is not null, then set * @return A new Cell */ public static Cell createCell(Row row, int column, String value, CellStyle style) { Cell cell = getCell(row, column); cell.setCellValue(cell.getRow().getSheet().getWorkbook().getCreationHelper() .createRichTextString(value)); if (style != null) { cell.setCellStyle(style); } return cell; }
/** * Creates a cell, gives it a value, and applies a style if provided * * @param row the row to create the cell in * @param column the column index to create the cell in * @param value The value of the cell * @param style If the style is not null, then set * @return A new Cell */ public static Cell createCell(Row row, int column, String value, CellStyle style) { Cell cell = getCell(row, column); cell.setCellValue(cell.getRow().getSheet().getWorkbook().getCreationHelper() .createRichTextString(value)); if (style != null) { cell.setCellStyle(style); } return cell; }
/** * Applies the drawn borders to a Sheet. The borders that are applied are * the ones that have been drawn by the {@link #drawBorders} and * {@link #drawBorderColors} methods. * * @param sheet * - {@link Sheet} on which to apply borders */ public void applyBorders(Sheet sheet) { Workbook wb = sheet.getWorkbook(); for (Map.Entry<CellAddress, Map<String, Object>> entry : _propertyTemplate .entrySet()) { CellAddress cellAddress = entry.getKey(); if (cellAddress.getRow() < wb.getSpreadsheetVersion().getMaxRows() && cellAddress.getColumn() < wb.getSpreadsheetVersion() .getMaxColumns()) { Map<String, Object> properties = entry.getValue(); Row row = CellUtil.getRow(cellAddress.getRow(), sheet); Cell cell = CellUtil.getCell(row, cellAddress.getColumn()); CellUtil.setCellStyleProperties(cell, properties); } } }