public void GetFormat() { Workbook workbook = new Workbook(); Worksheet worksheet = workbook.Worksheets.Add(); CellSelection cellSelectionA1 = worksheet.Cells[new CellIndex(0, 0)]; CellSelection cellSelectionA2B3 = worksheet.Cells[new CellRange(new CellIndex(1, 0), new CellIndex(2, 1))]; CellValueFormat cellSelectioA1Format = cellSelectionA1.GetFormat().Value; CellValueFormat cellSelectioA2Format = cellSelectionA2B3.GetFormat().Value; }
protected override string ConvertRowIndexToNameOverride(HeaderNameRenderingConverterContext context, int rowIndex) { int firstVisibleColumnIndex = context.VisibleRange.FromIndex.ColumnIndex; int firstTableColumnIndex = this.TableCellRange.FromIndex.ColumnIndex; int lastTableColumnIndex = this.TableCellRange.ToIndex.ColumnIndex; string result = base.ConvertRowIndexToNameOverride(context, rowIndex); if ((firstVisibleColumnIndex > firstTableColumnIndex && firstVisibleColumnIndex <= lastTableColumnIndex) && this.TableCellRange.Contains(rowIndex, firstVisibleColumnIndex)) { CellSelection selection = context.Worksheet.Cells[rowIndex, firstTableColumnIndex]; ICellValue cellValue = selection.GetValue().Value; CellValueFormat cellFormat = selection.GetFormat().Value; result = cellValue.GetResultValueAsString(cellFormat); } return(result); }