We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Extract all the NameCollections of a particular worksheet in Aspose C#

hi,
I want to get all the name collections from a particular sheet name say “test”, all though the workbook has many worksheets. I know the below code will get all the name collection from the workbook. Need only names from single worksheet.
Workbook _SourceWorkbook = new Workbook(path);
NameCollection names= _SourceWorkbook.Worksheets.Names;

Thanks in Advance

@kiran5388,

Please try the following sample code for your needs and for your reference:
e.g.
Sample code:

Workbook workbook = new Workbook(dir + "test.xlsx");
                int sheetIndex = workbook.Worksheets["Sheet2"].Index;
                List<Name> list = new List<Name>();
                foreach (Name name in workbook.Worksheets.Names)
                {
                    if (name.SheetIndex == sheetIndex + 1)
                    {
                        list.Add(name);
                    }
                }

Also, we found it is worthy feature to be added for the users, so we have logged a ticket (as new feature) with an id “CELLSNET-50332” for your requirements. We will support the requested feature in our upcoming release soon.

Thanks for the reply!

@kiran5388,

You are welcome.

This is to inform you that your issue has been resolved. The feature will be included in our upcoming release Aspose.Cells for .NET v22.2. You will also be informed once the next version is published.

The issues you have found earlier (filed as CELLSNET-50332) have been fixed in this update. This message was posted using Bugs notification tool by johnson.shi