Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Mon May 19, 2014 9:20 am

Hello,

I'm trying to use the ExportDataTable with the attached excel in order to get only the data rows, and not the headers and the first 2 empty rows. In order to accomplish this I'm executing the folowing sheet.ExportDataTable(4, 1, 9, 8, false);

According to the definition of the method, this call should return from the row 4 to the row 9 the first 8 columns, without exporting column names. Well, I've been making some tests and it seems the firstRow parameters is being ignored. What i'm getting executing this is the rows between 1 and 9 into the DataTable.

Am i doing something wrong?

I'm using version 7.0.0.7040
Attachments
Example.rar
(8.9 KiB) Downloaded 567 times

l.iglesias
 
Posts: 3
Joined: Tue Jan 29, 2013 2:40 pm

Tue May 20, 2014 2:00 am

Hello,

Thanks for your feedback.
We have noticed the issue you mentioned, which has been transferred to our Dev team, once there are any progress, we will inform you immediately. Sorry for inconvenience. And there is another method you can use.
Code: Select all
Workbook book = new Workbook();
book.LoadFromFile("Example.XLS");
Worksheet sheet = book.Worksheets[0];
DataTable dt = sheet.ExportDataTable(sheet.Range["A4:H9"], false);

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Tue May 27, 2014 6:29 am

Hello,

Regarding the issue, please download the Spire.Xls7.4 and test it again. And sheet.ExportDataTable(4, 1, 9, 8, false) function means that it starts from the row 4 and get 9 rows not to row 9, if you want to get 5 rows, you have to set it like this
Code: Select all
sheet.ExportDataTable(4, 1, 5(it is maxRows not row 5),8, false) ;

If there are any questions, welcome to get it back to us.
Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Return to Spire.XLS

cron