Filter Defined Names while loading Workbook
Possible Usage Scenarios
Aspose.Cells allows you to filter or remove defined names present inside the workbook. Please use LoadDataFilterOptions_DefinedNames to load defined names while loading the workbook. Please note, if you remove defined names, then formulas inside the workbook may break up.
Filter Defined Names while loading Workbook
The following sample code loads the sample Excel file, which has a formula in cell C1 containing the defined names, i.e., =SUM(MyName1, MyName2). Since we are using ~LoadDataFilterOptions_DefinedNames to remove the defined names while loading the workbook, the formula in cell C1 in the output Excel file breaks, up and you see #NAME? instead. Please see the following screenshot that shows the effect of the code on the sample Excel file.
Sample Code
loadFilter, _ := NewLoadFilter_LoadDataFilterOptions(LoadDataFilterOptions_DefinedNames | LoadDataFilterOptions_CellBlank) | |
loadOptions, _ := NewLoadOptions() | |
loadOptions.SetLoadFilter(loadFilter) | |
workbook, _ := NewWorkbook_String_LoadOptions("Book1.xlsx", loadOptions) | |
workbook.Save_String("Book2.xlsx") |