Unplanned
Last Updated: 20 Mar 2023 14:32 by Rekha
Rekha
Created on: 20 Mar 2023 14:32
Category: SpreadStreamProcessing
Type: Feature Request
1
SpreadStreamProcessing: Implement an equivalent of cellValue.GetValueAsString(format)

SpreadProcessing has a method,  cellValue.GetValueAsString(format), which allows the user to apply excel format on a value and get the result. While in SpreadStreamProcessing one could get the format and the value, there is no way to get their result and this is very inconvenient when the values in question are dates.

Workaround:

foreach (ICellImporter cell in rowImporter.Cells)
{
    string value = cell.Value;
    var format = cell.Format.NumberFormat;

    var cellValueFormat = new CellValueFormat(format);
   
    ICellValue cellValue;
    CellValueFormat valueFormat;

    CellValueFactory.Create(
        value,
        worksheet,
        new CellIndex(0, 0),
        cellValueFormat,
        out cellValue,
        out valueFormat);

    var formattedValue = cellValue.GetResultValueAsString(cellValueFormat);
}
0 comments