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 Mar 11, 2020 2:28 pm

Hello,

Is there a direct way to select ranges like "A:B" or "1:2" from a worksheet instance (we're converting it to indexes for now) ?

Thanks by advance.

gestrextaj
 
Posts: 1
Joined: Fri Feb 28, 2020 1:54 pm

Thu Mar 12, 2020 3:37 am

Hello,

Thanks for your inquiry.
Do you want to get cell range for specific rows or columns? Like the cell range from the first column to the second column? If so, you could refer to the following code.
Code: Select all
    //CellRange[int row, int column, int lastRow, int lastColumn]
    //Get the cell range from the first column to the second column
    CellRange range1 = sheet.Range[sheet.FirstRow, sheet.FirstColumn, sheet.LastRow, 2];
    //Get the cell range from the first row to the second row
    CellRange range2 = sheet.Range[sheet.FirstRow, sheet.FirstColumn, 2, sheet.LastColumn];

Or if I misunderstood, please provide more detailed information about your requirement. So that we could provide you with a corresponding solution.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Tue Mar 17, 2020 6:45 am

Hello,

Greetings from E-iceblue!
Have you tested my code? Does it meet your needs?
Any feedback will be greatly appreciated!

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Return to Spire.XLS