Issue 1 |
When the first row have a null values, the method takes all the values as if they were text, and export the excel in this way:
But i need this columns on number format, so i have to open the document and modify the format of the cells.
Is there any way to export it in numerical format even though the first row have null values?
|
We are able to reproduce the issue and validating it currently. We will provide further details on 14th October 2019.
|
Issue 2 |
I have a null row in the middle of the result, so when i trying to export this data to excel, i suppose the method try to convert null columns( 5 to 9) to number and i get the follow error:
Is there any way to export it that result to excel or i need to always parse the null values to '0'? |
We are unable to reproduce the reported “Object cannot be cast from DBNull to other types” exception, but we are facing “Specified cast is not valid” exception.
|
using (ExcelEngine excelEngine = new ExcelEngine())
{
IApplication application = excelEngine.Excel;
application.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = application.Workbooks.Create(1);
IWorksheet worksheet = workbook.Worksheets[0];
ExcelImportDataOptions importDataOptions = new ExcelImportDataOptions();
importDataOptions.FirstRow = 2;
importDataOptions.FirstColumn = 1;
importDataOptions.IncludeHeader = false;
importDataOptions.PreserveTypes = false;
//Import the data to worksheet
IList<object> reports = GetSalesReports1();
worksheet.ImportData(reports, importDataOptions);
workbook.SaveAs("ImportFromDT.xlsx");
} |