I’m working with the Open XML SDK to create an Excel document. To save time, I start with an existing document, and just make the changes I need.
To locate certain cells, my existing document defines a number of ranges. However, when I’m done I’d like to remove those ranges.
I can’t seem to find any way to remove ranges from an Excel document that already has them. Any tips, suggestions or links?
Ranges are stored as defined names under the workbook element. You will need to find the defined name element based on the name you gave it in the worksheet and then delete it that way.
This is just a quick snippet of what you might have to do. Obviously, you might need error checking if the
DefinedNameselement doesn’t exist or the defined named you want to delete has already been deleted, but hopefully this will point you in the right direction.