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.

Wed Dec 07, 2016 12:52 am

It seems there are two ways to get/set cell values:
sheet.Range[row,col];//1-base index
sheet.Rows[row].Cells[col];//0-based index
I wander if there is any difference between these two methods?

Jay.L
 
Posts: 8
Joined: Fri Dec 02, 2016 2:54 am

Wed Dec 07, 2016 2:57 am

Dear Jay.L,

Thanks for your inquiry.
Here is a difference between them when getting/setting value.
sheet.Rows[row].Cells[col], this can only get/set the value of existing cell, otherwise it will throw IndexOutOfRangeException.
If there is any question, welcome to get it back to us.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.XLS