Hi, with this code:
Aspose.Cells.License c_license = new Aspose.Cells.License();
c_license.SetLicense(@“C:\Program Files (x86)\Aspose\Aspose.Cells\License\license.lic”);
Workbook aWk = new Workbook();
aWk.Open(“c:\temp\DeleteSheetNotREmoveNames.xls”);
aWk.Worksheets.RemoveAt(0);
aWk.Save(“c:\temp\DeleteSheetNotREmoveNames_new.xls”);
I remove first worksheet with a local name called ‘LocalName’, after remove it the name still exists with a #RIF error (and Cartel name attribute)
May you verify or suggest me a workaround ?
many thanks
Paolo
Hi Paolo,
Thanks for your inquiry.
Well, I think you may try to delete the local named range or make it invisible before deleting the first worksheet in the workbook, see the following sample code.
Sample code:
Aspose.Cells.License c_license = new Aspose.Cells.License();
c_license.SetLicense(@"C:\Program Files (x86)\Aspose\Aspose.Cells\License\license.lic");
Workbook aWk = new Workbook();
aWk.Open("c:\\temp\\DeleteSheetNotREmoveNames.xls");
Names names = aWk.Worksheets.Names;
//You can delete the named range
names.Remove("Foglio1!LocalName");
//Or you may make it invisible.
//Name fname = aWk.Worksheets.Names["Foglio1!LocalName"];
//fname.RefersTo = "";
//fname.IsVisible = false;
aWk.Worksheets.RemoveAt(0);
aWk.Save("c:\\temp\\DeleteSheetNotREmoveNames_new.xls");
Thank you.
Hi, thanks for reply.
Remove is too slow for my workbooks (I have to remove sheets with more than 6/700 names)
Setting refersto/isvisible before remove is ok and very fast
thanks again.
Paolo