@Override public ICellStyle getStyle() { return delegate.getStyle(); }
public ICellStyle getStyle() { return delegate.getStyle(); }
public ICellStyle getStyle() { return cell.getStyle(); }
private static IFormatter getNumberFormatter(ICell cell) { IFormatter formatter = null; ICellStyle xlsStyle = cell == null ? null : cell.getStyle(); if (xlsStyle != null) { short formatIndex = xlsStyle.getFormatIndex(); String format = xlsStyle.getFormatString(); if (format.contains("#\" \"")) { format = format.replaceAll("#\" \"", "# "); } formatter = new XlsNumberFormatter(formatIndex, format, dataFormatter, locale); } return formatter; }
private static IFormatter getDateFormatter(ICell cell) { IFormatter formatter = null; ICellStyle xlsStyle = cell == null ? null : cell.getStyle(); if (xlsStyle != null) { String format = xlsStyle.getFormatString(); if (StringUtils.isBlank(format) || format.equals(FormatConstants.GENERAL_FORMAT)) { format = FormatConstants.DEFAULT_XLS_DATE_FORMAT; } formatter = new XlsDateFormatter(format); } return formatter; }
/** * @param tableProperties properties of the table that is going to be copied. * @return style of the properties section in table if exists. If no <code>NULL</code>. */ protected ICellStyle getPropertiesStyle(ITableProperties tableProperties) { ICellStyle propertiesStyle = null; ILogicalTable propertiesSection = tableProperties.getPropertiesSection(); if (propertiesSection != null) { propertiesStyle = propertiesSection.getSource().getCell(0, 0).getStyle(); } return propertiesStyle; }
/** * @param tableProperties properties of the table that is going to be copied. * @return style of the properties section in table if exists. If no <code>NULL</code>. */ protected ICellStyle getPropertiesStyle(ITableProperties tableProperties) { ICellStyle propertiesStyle = null; ILogicalTable propertiesSection = tableProperties.getPropertiesSection(); if (propertiesSection != null) { propertiesStyle = propertiesSection.getSource().getCell(0, 0).getStyle(); } return propertiesStyle; }
/** * * @param tableProperties properties of the table that is going to be copied. * @return style of the properties section in table if exists. If no <code>NULL</code>. */ protected ICellStyle getPropertiesStyle(ITableProperties tableProperties) { ICellStyle propertiesStyle = null; ILogicalTable propertiesSection = tableProperties.getPropertiesSection(); if (propertiesSection != null) { propertiesStyle = propertiesSection.getSource().getCell(0, 0).getStyle(); } return propertiesStyle; }
private static AUndoableCellAction shiftCell(int colFrom, int rowFrom, int colTo, int rowTo, IGrid grid, MetaInfoWriter metaInfoWriter) { if (!grid.isPartOfTheMergedRegion(colFrom, rowFrom) || grid.isTopLeftCellInMergedRegion(colFrom, rowFrom)) { // non top left cell of merged region have to be skipped return new UndoableShiftValueAction(colFrom, rowFrom, colTo, rowTo, metaInfoWriter); } return new SetBorderStyleAction(colTo, rowTo, grid.getCell(colFrom, rowFrom).getStyle(), false, metaInfoWriter); }
public FormattedCell(ICell delegate, CellMetaInfo cellMetaInfo) { this.delegate = delegate; try { this.objectValue = this.delegate.getObjectValue(); } catch (IncorrectFormulaException e) { //logged in XlsCell.getObjectValue() method. this.objectValue = ERROR_VALUE; } this.formattedValue = XlsDataFormatterFactory.getFormattedValue(delegate, cellMetaInfo); this.font = new CellFont(delegate.getFont()); this.style = new CellStyle(delegate.getStyle()); this.metaInfo = cellMetaInfo; }
ICellStyle style = editorModel.getOriginalGridTable().getCell(col, row).getStyle(); if (style == null || style.getHorizontalAlignment() != halign) { try {
public void doAction(IGridTable table) { IWritableGrid grid = (IWritableGrid) table.getGrid(); ICellStyle style = grid.getCell(getCol(), getRow()).getStyle(); prevIndent = style != null ? style.getIndent() : 0; grid.setCellIndent(getCol(), getRow(), newIndent); }
public void doAction(IGridTable table) { IWritableGrid grid = (IWritableGrid) table.getGrid(); ICellStyle style = grid.getCell(getCol(), getRow()).getStyle(); prevColor = style != null ? style.getFillForegroundColor() : null; grid.setCellFillColor(getCol(), getRow(), newColor); }
public void doAction(IGridTable table) { IWritableGrid grid = (IWritableGrid) table.getGrid(); ICellStyle style = grid.getCell(getCol(), getRow()).getStyle(); prevAlignment = style != null ? style.getHorizontalAlignment() : HorizontalAlignment.GENERAL; grid.setCellAlignment(getCol(), getRow(), newAlignment); }
protected void savePrevCell(IWritableGrid grid) { ICell cell = grid.getCell(col, row); setPrevValue(cell.getObjectValue()); setPrevFormula(cell.getFormula()); setPrevStyle(cell.getStyle()); setPrevComment(cell.getComment()); setPrevMetaInfo(metaInfoWriter.getMetaInfo(row, col)); }
private SubValue[] createSV(TableColumn column, IGridTable grid, int r, int subColumns) { SubValue[] values = new SubValue[subColumns]; for (int c = 0; c < subColumns; c++) { String value = grid.getCell(c, r).getStringValue(); if (value == null) { value = ""; } else { // kill extra spaces -- fix type errors value = value.trim(); } String cellName = "cell" + r + "_" + column.getColumnIndex() + "_" + c; StringValue sv = new StringValue(value, cellName, cellName, new GridCellSourceCodeModule(grid, c, r, bindingContext)); values[c] = new SubValue(sv, grid.getCell(c, r).getStyle()); IGridTable lr = grid.getSubtable(c, r, 1, 1); values[c].setGridRegion(lr.getRegion()); } return values; }
public String setIndent() { int row = getRow(); int col = getCol(); String editorId = getEditorId(); TableEditorModel editorModel = getEditorModel(editorId); if (editorModel != null) { TableModificationResponse response = new TableModificationResponse(null, editorModel); int indent = getRequestIntParam(Constants.REQUEST_PARAM_INDENT); ICellStyle style = editorModel.getOriginalGridTable().getCell(col, row).getStyle(); int currentIndent = style != null ? style.getIndent() : 0; int resultIndent = currentIndent + indent; try { editorModel.setIndent(row, col, resultIndent >= 0 ? resultIndent : 0); } catch (Exception e) { log.error(ERROR_SET_STYLE, e); response.setMessage(ERROR_SET_STYLE); } return pojo2json(response); } return null; }
public String setIndent() { int row = getRow(); int col = getCol(); String editorId = getEditorId(); TableEditorModel editorModel = startEditing(editorId); if (editorModel != null) { TableModificationResponse response = new TableModificationResponse(null, editorModel); int indent = getRequestIntParam(Constants.REQUEST_PARAM_INDENT); ICellStyle style = editorModel.getOriginalGridTable().getCell(col, row).getStyle(); int currentIndent = style != null ? style.getIndent() : 0; int resultIndent = currentIndent + indent; try { editorModel.setIndent(row, col, resultIndent >= 0 ? resultIndent : 0); } catch (Exception e) { log.error(ERROR_SET_STYLE, e); response.setMessage(ERROR_SET_STYLE); } return pojo2json(response); } return null; }
public void undoAction(IGridTable table) { IWritableGrid grid = (IWritableGrid) table.getGrid(); ICell cell = grid.getCell(getCol(), getRow()); setPrevValue(cell.getObjectValue()); setPrevFormula(cell.getFormula()); setPrevStyle(cell.getStyle()); setPrevComment(cell.getComment()); if (toRemove != null) { grid.removeMergedRegion(toRemove); grid.addMergedRegion(toRestore); } grid.setCellFormula(colFrom, rowFrom, getPrevFormula()); grid.setCellValue(colFrom, rowFrom, getPrevValue()); grid.setCellStyle(colFrom, rowFrom, getPrevStyle()); grid.setCellComment(colFrom, rowFrom, getPrevComment()); metaInfoWriter.setMetaInfo(rowFrom, colFrom, getPrevMetaInfo()); }
public void doAction(IGridTable table) { IWritableGrid grid = (IWritableGrid) table.getGrid(); IGridRegion rrFrom = grid.getRegionStartingAt(colFrom, rowFrom); ICell cell = grid.getCell(colFrom, rowFrom); setPrevValue(cell.getObjectValue()); setPrevFormula(cell.getFormula()); setPrevStyle(cell.getStyle()); setPrevComment(cell.getComment()); setPrevMetaInfo(metaInfoWriter.getMetaInfo(rowFrom, colFrom)); if (rrFrom != null) { toRestore = rrFrom; grid.removeMergedRegion(rrFrom); GridRegion copyFrom = new GridRegion(rrFrom.getTop() + getRow() - rowFrom, rrFrom.getLeft() + getCol() - colFrom, rrFrom.getBottom() + getRow() - rowFrom, rrFrom.getRight() + getCol() - colFrom); grid.addMergedRegion(copyFrom); toRemove = copyFrom; } grid.setCellFormula(getCol(), getRow(), getPrevFormula()); grid.setCellValue(getCol(), getRow(), getPrevValue()); grid.setCellStyle(getCol(), getRow(), getPrevStyle()); grid.setCellComment(getCol(), getRow(), getPrevComment()); metaInfoWriter.setMetaInfo(getRow(), getCol(), getPrevMetaInfo()); ICell newCell = grid.getCell(getCol(), getRow()); if (cell.getType() == IGrid.CELL_TYPE_STRING && newCell.getType() == IGrid.CELL_TYPE_FORMULA) { grid.setCellStringValue(getCol(), getRow(), cell.getObjectValue().toString()); } }