Izenda Logo

This documentation is for the legacy Izenda 6 product. Documentation for the new Izenda 7 product can be found at https://www.izenda.com/docs/

Original: class CustomDateFormatter : IFormatter, IExcelFormatter { public string GetExcelCellClass { get { return "xls-text"; } } _ _public Type GetOutputDataType(DataTable table, int columnNumber, ReportOutputOptions reportOutputOptions, Field field) { return typeof(string); } _ _public object Format(DataTable table, int rowNumber, int columnNumber, Field field, DataTable originalTable, Field nameField) { var value = table.Rows[rowNumber][columnNumber]; if (value == null || value == DBNull.Value) return ""; return string.Format("{0:dd MMM yyyy}", value); } }

Updated: class CustomDateFormatter : BaseFormatter, IExcelFormatter { public string GetExcelCellClass { get { return "xls-text"; } } public override Type GetOutputDataType(AdHocDataTable table, int columnNumber, ReportOutputOptions reportOutputOptions, Field field) { return typeof(string); } public override object Format(AdHocDataTable table, int rowNumber, int columnNumber, Field field, AdHocDataTable originalTable, Field nameField) { var value = table.Rows[rowNumber][columnNumber]; if (value == null || value == DBNull.Value) return ""; return string.Format("{0:dd MMM yyyy}", value); } }