ExportDataTable with ExportTableOptions

Hi,


I have a requirement to load the data’s in an Excel sheet [which has the FX Rate of currencies against USD for last one months] to data table. The columns and row in the excel sheet as below,
First Row (Column 1 & 2) is a merged cell which has the "Currency."
Second row Column 1 is a sub header called "Date"
Second row column 2 is a sub header called "FxRate"
The above repeats for column (3, 4) , (5,6), (7,8) and (9,10) i.e. for a set of 5 currencies against USD.
I want to load the data’s per currency [taking columns (1,2), (3,4) etc]. I am using the below statements in a loop,
{
ExportTableOptions Options = New ExportTableOptions();
Options.SkipErrorField = true; Options.ExportColumnNames = true; int colIndex = 0;
DataTable dt = Cells.ExportDataTable(1,colIndex,MaxRows, 2, Options)
//Do Some processing over the readed records
colIndex = colIndex+2
}

With this, the values in the first 2 columns are loaded into the datatable in the first iteration, whereas in the second iteration I am getting an exception “Cannot find the column index -2” [sometimes it says -1].

How do I read the data’s from the excel sheet with above requirement [reading 2 columns at a time in an loop]?

Hi,


Your error is due to invalid column/row indices in the statement:
"DataTable dt = Cells.ExportDataTable(1,colIndex,MaxRows, 2, Options)"
which is not matching in accordance with your data in your sheet for your code. Please correct it to fix the issue.

Please debug your code and check the parameters and their values in each loop to find your issue and then fix it.


If you still could not evaluate your issue, kindly give us your sample file and your complete runnable code or a sample console application (you ma zip it prior attaching here), to post/attach it here to show the issue, we will check your issue soon.

Thank you.


Thank you for the response.


I think the question is misleading. Will send you the console application and sample excel sheet.




Hi,


Thanks for your work and cooperation.

We will wait your sample console application with sample Excel file to evaluate your issue properly.

Thanks,


I have attached the Zip file which has the input file as well. To have the issue replicated, please debug it and the issue will occur in second iteration itself.


Before debugging, please change the file path in program.cs.
Hi,

Thanks for the sample project with the template file.

After an initial test, I can notice the issue as you have mentioned. It gives me error if we use ExportDataTable method involving ExportTableOptions to fill a datatable having some cells merged in its first row, it works for the first iteration though(as you mentioned).

I have tested your sample project with your template file and found the issue.

I have logged a ticket with an id: "CELLSNET-41204" for your issue. We will look into your issue soon.

By the way, for the time being you may try the following to fix your issue now:
In your project, replace the line i.e.:
dataTable = worksheet.Cells.ExportDataTable(1, intCol, maxRowInCol, 2, option);
with:
dataTable = worksheet.Cells.ExportDataTableAsString(1, intCol, maxRowInCol, 2, true);
it works fine though.

And, we will continue to look into your issue to figure it out soon.

Thank you.

Hi,

We have fixed this issue.

Please download and try this fix: Aspose.Cells for .NET v7.3.4.1 and let us know your feedback.

Hi,


Thank you for Fixing this. We are using the licensed version 7.2.2.0. Can the fix be retrofitted to the earlier version (v7.2.2.0) as well.

Thanks,
Anand J

Hi,

Thanks for your feedback and using Aspose.Cells.

I am afraid, we provide fixes based on latest versions only. You must upgrade your application to newer version.

Please check your license expiry date. If your license has not expired, then you can use this version without any concerns.

However, if your license has expired, then you must upgrade your license subscription to use this version.

For any license and purchase related questions, please post your query on Aspose.Purchase forum.

PS:
In order to check your license expiry date, please open your license file in a notepad and read the subscription expiry date.

Hello,


Thank you to guide us with this regard.

Our license is valid till next year. Can we download the latest version of the Aspose libraries and use them with the same license that we have?

Can this be done for the rest of the license period till expiry and upgrade to the latest libraries?

Thanks
Anand J

Hi,

Yes, you can use this version and any other next version till your license expires without any concerns.

Also, this is a minor release. It is good for production use. In the middle of next month, we will publish major release (official release) which you can download from this link.


Both minor and major releases are good for production use. However, major (official) release is also published with Release Notes and other related files.

Thank you. Will check it out.

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

You can now download and use the Major Official Release which we have published recently to upgrade your application from the following link.


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


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