ExportDataTable Overflow / Underflow Issues

I am trying to export data from a .CSV to a DataTable. I am using the ExportDataTable(dataTable, firstRow, firstColumn, rowNumber, exportColumnName) version of the function. The problem I am running into is that the data file contains an entry that is too small to be represented by a Decimal, which is the type for that column in the input DataTable for the ExportDataTable function. When the Aspose code hits this one cell, it throws and exception and the export fails. a CellsExcepetion is thrown with a message of "Invalid data of B5,the data should be less than decimal.MaxValue and greater than decimal.MinValue."

Is there anyway to provide a default value so that if the ExportDataTable can’t parse a cell, that value is used? Or possibly that it just skips the row it can’t handle. Something where the entire export doesn’t fail because of one row / cell. The only other way I can think of to parse a file where there is bad data is to Export every column AsString and then convert each cell back by hand.

Hi,

The issue is caused by one column type of the datatable is decimal and the value of one cell should be less than decimal.MaxValue and greater than decimal.MinValue. Please simply change the column type as double for your scenario. And we will look into how to skip some invalid data in exporting date to tables.

Thank you.

Hi,

Please try the attached version v4.7.1.8. We have added two new method versions to skip the error value.

/// Indicates whether skip invalid value for the column.

/// For example,if the column type is decimal ,the value is greater than decimal.MaxValue

/// and this property is true,we will not throw exception again. public void ExportDataTable(DataTable dataTable, int firstRow, int firstColumn,

int rowNumber, bool exportColumnName,bool skipErrorValue)

public void ExportDataTable(DataTable dataTable, int firstRow, int[] columnIndexes,

int rowNumber, bool exportColumnName, bool skipErrorValue)

Thank you.

So to be clear, by setting the bool flag skipErrorValue to true, it will not throw any exceptions if it can’t handle the cell value? Will it fail to import the entire row then, or add the row but put some default (or null) value there?

Thanks,

Hi,

We will get back to you to clarify your query in details.

Thank you.

Hi,

Well, to explain you, if the bool flag skipErrorValue is true, we will not throw any exception. And, if there is an invalid cell value in a row, we will still add a new row to the data table filling all other cell values to the new row, and keep that cell value (invalid) as null accordingly.

Thank you.

Is there a .Net 2.0 version of that?

Hi,

Ok, we will soon provide you the .NET 2.0 compiled version of the product for your need.

Thank you.

Hi,

Thank you for considering Aspose.

Please try the attached latest version of Aspose.Cells for .NET (.NET 2.0 version) as per your requirement.

Thank You & Best Regards,

The issues you have found earlier (filed as 9062) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Note: Just for your knowledge. In the new release v4.8.0, we have merged Aspose.Grid suite to Aspose.Cells for .NET msi installer as Aspose.Grid would be no longer offered as a separate product now. You need to install the installer (uninstall older one first if you have) and use only Aspose.Cells.dll library in your project for your need. You may also take advantage using Aspose.Cells Grid suite though.