Error with ExportDataTable

Hello,
I’ve got an error with the xlsx file and the code attache to this topic.
Aspose.zip (8.5 KB)

@julien.mevel.isilog

It seems like you are using Aspose.Cells. We are moving your inquiry in respective forum category where you will be assisted accordingly.

@julien.mevel.isilog,

I checked your code which is not right. Please note, Worksheet.Cells.Columns.Count gives (zero-based) columns count (that are initialized), you may also use Worksheet.Cells.MaxDataColumn instead. So, you got to traverse your loop starting from “0” indexed position instead of “1”. See the updated code segment (that you may try) which works fine as I tested:
e.g
Sample code:

.......
DataTable dt = new DataTable();
             for (int i = 0; i <= workbook.Worksheets[0].Cells.Columns.Count; i++)
            { 
                dt.Columns.Add().DataType = Type.GetType("System.String");

                options.DataTable = dt;
            }
            workbook.Worksheets[0].Cells.ExportDataTable(0, 0, 44, 2, options);

Hope, this help a bit.