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

Free Support Forum - aspose.com

Clean unused names?

Hi, is there any function which can clean all ‘unused’ named ranges safely? For example, i would like to clean all named ranges which is not reference in the same workbook?
_workbook.Worksheets.Names.Clear(); … this also clean the name which is refereed to … so not suitable.


Thanks for your query.

I think you may check if a named range is referenced or not using Name.IsReferred Boolean attribute, see the sample code segment for your rerference:
Sample code:

NameCollection names = workbook.Worksheets.Names;
            int i = names.Count - 1;
            while (i >= 0)
                if (!names[i].IsReferred)

Hope, this helps a bit.