Free Support Forum - aspose.com

ExportDataTable Issue

We have had version 2.8.0.1 in our company and it was working great. Just doing basic things like export an Excel File to a DataSet and Export a DataSet to an Excel file. I upgraded to the latest version 3.4.0 today and am having all sorts of Data Corruption.

This is the code I’m using:

DataTable table = sheet.Cells.ExportDataTable(0, 0, maxRow, maxColumn, true);
When I make this call now, I either have exceptions being thrown, or the data that comes in is corrupted. It’s different each time I run the same method with the same file as well. You can see below that the colum name didn’t come in correctly. Also, sometimes the data won’t come in either. The Excel file is big, but there was no issue with this file in 2.8.0.1. Is there something that I’m missing?

Thanks in Advanced,
Jamie

Example of Corrupted Column Name:

<xs:element name=“Loan_Information_Values”>
xs:complexType
xs:sequence
<xs:element name=“zWGX92” type=“xs:string” minOccurs=“0”/>
<xs:element name=“type” type=“xs:string” minOccurs=“0”/>
<xs:element name=“date” type=“xs:string” minOccurs=“0”/>
<xs:element name=“value” type=“xs:string” minOccurs=“0”/>
</xs:sequence>
</xs:complexType>
</xs:element>

Example of Corrupted Data:


<scheme_name>SentryId</scheme_name>
<scheme_identifier>881</scheme_identifier>
<trust_scheme_name>SentryId</trust_scheme_name>
<trust_scheme_identifier>chpHshYNALbWLrh</trust_scheme_identifier>
A2Notes
A-2 Note balance
formulaText
<waterfall_order>4</waterfall_order>
<node_type>calculation</node_type>
<parent_waterfall_scheme_name>SentryId</parent_waterfall_scheme_name>
<parent_waterfall_scheme_identifier>876</parent_waterfall_scheme_identifier>

I think you bought the license before 2005/01/22. Please check http://www.aspose.com/Wiki/default.aspx/Aspose.Excel/LicensingComponent.html for reference.

Those random string is added in evaluation edition. We have changed our license schema since 2005/01/22. You should contact our sales team to upgrade your license file.

Laurence,

Just redirect customers to http://www.aspose.com/Wiki/default.aspx/Aspose.Purchase/OldOrderPolicy.html when they need new license file.

I deleted the license information for it's not appropriate to make it public.

How do you call the license code? Please check http://www.aspose.com/Wiki/default.aspx/Aspose.Excel/LicensingComponent.html for reference.

Could you please post your template file here? It can only be accessed by you and Aspose developers.

Sure, here you go…

Oh, do I have to set it on the open? I was just setting it when I saved…

The following is my test code and all works fine:

Aspose.Excel.License license = new Aspose.Excel.License();
license.SetLicense("d:\\Aspose.Excel.lic");

Excel excel = new Excel();
excel.Open("d:\\CDO1TestStructure.xls");

Excel excel2 = new Excel();

for(int i = 0; i < excel.Worksheets.Count; i ++)
{
excel2.Worksheets.Add();
DataTable dt = excel.WorksheetsIdea.Cells.ExportDataTableAsString(0, 0, excel.Worksheets[0].Cells.MaxRow, excel.Worksheets[0].Cells.MaxColumn, true);
excel2.WorksheetsIdea.Cells.ImportDataTable(dt, true, 0, 0);
}
excel2.Save("d:\\book1.xls");

Yes. Set license before opening the file and you just need to set once in your program. Generally please set it at the start of your program.

OK, once I set the license on the import, it worked great. Thank you for your help.