c# - EPPlus - How to rename a named range and maintain correct formulas? -
i have excel file named range (just 1 cell). there other cells who's formulas use name. trying programatically rename cell using epplus. first attempt removed old name , added new:
workbook.names.remove("oldname"); workbook.names.add("newname", mysheet.cells["b2"]);
this worked rename range, formulas still use "oldname" come #name?
instead of corresponding cell's value.
if reference name using linq var namereference = workbook.names.first(x => x.name == "oldname")
notice trying set name property namereference.name == "newname"
read-only property.
is there method haven't seen renaming these named ranges? if not, alternatives there situation? if reference cells who's formulas call named range change each formula. think need scan every used cells' formulas reference, think take while, considering may have dozens of excel workbooks scan through.
Comments
Post a Comment