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.

Tue Sep 20, 2022 2:34 pm

The use of getCellRange() with named range return the cellRange even if it is not located into the referred worksheet.

Follow the steps to reproduce :
- Create a workbook with two worksheet ;
- Select a range of cells into the second worksheet and give it a name (ex. : "testRange") ;
- Try to get the cell range from the first worksheet (ws1.getCellRange("testRange"'))

=> The return of the getCellRange from the first worksheet call return a value of cellRange from the second worksheet. It should not.

QuentinSup
 
Posts: 46
Joined: Mon Oct 18, 2021 9:18 am

Wed Sep 21, 2022 6:09 am

Hello,

Thanks for your inquiry.
According to your information, I guess that you didn’t select scope for the selected cell range, if you don’t select, the default scope of the selected cell range is workbook and you can get this cell rang from each worsheet object , as shown in the screenshot below. Therefore, if you want the cell range to belong to only one worksheet, you need to select the corresponding scope for it.
If you have any issue, just feel free to contact us.

Sincerely
Abel
E-iceblue support team
Attachments
Picture1.png
Picture1.png (32.5 KiB) Viewed 494 times
User avatar

Abel.He
 
Posts: 964
Joined: Tue Mar 08, 2022 2:02 am

Return to Spire.XLS