We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Export Excel

Hi,
I have a problem with the ImportDataView method.
When I use this method with a DataView having null column values, the XlsIo Api throw this
excption :

System.InvalidCastException: Unable to cast object of type 'System.DBNull' to type 'System.String'.

Thanks
Simon.



5 Replies

MW Melba Winshia Syncfusion Team February 21, 2007 01:40 PM UTC

Hi Simon,

Thanks for your interest in Essential XlsIO.

I am afraid. I was not able to reproduce the issue [System.InvalidCastException]. Here is the test sample that I used to test this issue.

a rel='nofollow' href="http://www.syncfusion.com/Support/user/uploads/ImportDataTable_Null_661650be.zip">ImportDataTable_Null.zip

Here is the output file generated with out any exception:

SampleOne.xls

Could you please take a look at the sample above and kindly let me know if you still find any problem, if not could you please modify this sample so that I can reproduce the issue. This would help me in investigating this issue further.

Thanks,
Melba


LE Leonid June 18, 2007 08:23 PM UTC

Hi Melba,

You will get that error if you make the following changes in your coding

1. ImportDataTable instead of ImportDataView
2. row["item"] = System.DBNull.Value

Thanks,
Leonid

>Hi Simon,

Thanks for your interest in Essential XlsIO.

I am afraid. I was not able to reproduce the issue [System.InvalidCastException]. Here is the test sample that I used to test this issue.

a rel='nofollow' href="http://www.syncfusion.com/Support/user/uploads/ImportDataTable_Null_661650be.zip">ImportDataTable_Null.zip

Here is the output file generated with out any exception:

SampleOne.xls

Could you please take a look at the sample above and kindly let me know if you still find any problem, if not could you please modify this sample so that I can reproduce the issue. This would help me in investigating this issue further.

Thanks,
Melba


MW Melba Winshia Syncfusion Team June 19, 2007 04:51 AM UTC

Hi Leonid,

I modified the coding as per your suggestions. But I was not able to reproduce the error. Here is the modified sample for your reference:

http://websamples.syncfusion.com/samples/XlsIO.Windows/F56732/main.htm

Could you please take a look at the sample above and kindly let me know if you still find any problem, if not could you please modify this sample so that I can reproduce the issue. This would help me in investigating this issue further.

Thanks,
Melba


LE Leonid June 20, 2007 04:29 PM UTC

Hi Melba,

You didn't make one change that I mentioned in my previous email. If you replace

mySheet.ImportDataView(view, true, 1, 1, true);

with

mySheet.ImportDataTable(table, true, 1, 1, true);

in your coding you will get that error.

Thanks,
Leonid


MW Melba Winshia Syncfusion Team June 25, 2007 07:04 AM UTC

Hi Leonid,

I was able to reproduce the problem in version 4.3.0.30. However, this issue is fixed in version 4.4 and its above version (5.1). Could you please upgrade to our latest versions? Here is the video clip for your reference:(to show that issue is fixed)

http://www.syncfusion.com/Support/user/uploads/Fixedinnewversion_cc2e0750.zip

Kindly let me know if you have any other questions.

Thanks,
Melba



Loader.
Live Chat Icon For mobile
Up arrow icon