Free Support Forum - aspose.com

ExportDataTableAsString => Row number or column number cannot be zero

Hello,

When trying to export a XLS file to a DataTable, I get an error "Row number or column number cannot be zero" if rowNumber equals 1.

I use the following code line :

DataTable table = workbook.Worksheets[0].Cells.ExportDataTableAsString(0, 0, 1, 12, true);

I found that this was corrected for ExportDataTable (<a href="</a>) but I have the feeling it has not been corrected for ExportDataTableAsString. Could you please confirm this?</p><p>Thank you.</p><p>Regards.</p>

Hi,

I have tested the ExportDataTableAsString method related your scenario with latest version/fix (v6.0.1.3 - Please download: Aspose.Cells for .NET (Latest Version) . ), it also works fine with ExportDataTableAsString() method.
Here is a sample code for your reference, I use a simple CSV file which has one header row with 12 columns in the first worksheet in it.

Sample code:
Workbook wb = new Workbook(@"e:\test\\myissue.csv", new LoadOptions(LoadFormat.CSV));
DataTable dt = wb.Worksheets[0].Cells.ExportDataTableAsString(0, 0, 1, 12, true);
wb.Worksheets[wb.Worksheets.Add()].Cells.ImportDataTable(dt, true, "A1");
wb.Save("e:\\test2\\outTestExportDataTableAsString.xls");

If you still find the issue, kindly do attach your template file here to show the issue, we will check your issue soon.

The output file is also attached here.

Thank you.