officefileapi-devexpress-dot-spreadsheet-dot-export-534de80a.md
Base interface implemented by converters which are used by the DataTableExporter.
Namespace : DevExpress.Spreadsheet.Export
Assembly : DevExpress.Spreadsheet.v25.2.Core.dll
NuGet Package : DevExpress.Spreadsheet.Core
public interface ICellValueToColumnTypeConverter
Public Interface ICellValueToColumnTypeConverter
The following members return ICellValueToColumnTypeConverter objects:
class MyConverter : ICellValueToColumnTypeConverter
{
public bool SkipErrorValues { get; set; }
public CellValue EmptyCellValue { get; set; }
public ConversionResult Convert(Cell readOnlyCell, CellValue cellValue, Type dataColumnType, out object result)
{
result = DBNull.Value;
ConversionResult converted = ConversionResult.Success;
if (cellValue.IsEmpty)
{
result = EmptyCellValue;
return converted;
}
if (cellValue.IsError)
{
// You can return an error, subsequently the exporter throws an exception if the CellValueConversionError event is unhandled.
//return SkipErrorValues ? ConversionResult.Success : ConversionResult.Error;
result = "N/A";
return ConversionResult.Success;
}
result = String.Format("{0:MMMM-yyyy}", cellValue.DateTimeValue);
return converted;
}
}
Friend Class MyConverter
Implements ICellValueToColumnTypeConverter
Public Property SkipErrorValues() As Boolean
Public Property EmptyCellValue() As CellValue Implements ICellValueToColumnTypeConverter.EmptyCellValue
Public Function Convert(ByVal readOnlyCell As Cell, ByVal cellValue As CellValue, ByVal dataColumnType As Type, ByRef result As Object) As ConversionResult Implements ICellValueToColumnTypeConverter.Convert
result = DBNull.Value
Dim converted As ConversionResult = ConversionResult.Success
If cellValue.IsEmpty Then
result = EmptyCellValue
Return converted
End If
If cellValue.IsError Then
' You can return an error, subsequently the exporter throws an exception if the CellValueConversionError event is unhandled.
'return SkipErrorValues ? ConversionResult.Success : ConversionResult.Error;
result = "N/A"
Return ConversionResult.Success
End If
result = String.Format("{0:MMMM-yyyy}", cellValue.DateTimeValue)
Return converted
End Function
End Class
See Also