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

Free Support Forum - aspose.com

Get/Set Property RefersTo in Name object

Hi,
I’ve a problem using RefersTo property.
I’ve to check if RefersTo return “null” value (to find invalid name) with a test like:

foreach (Name aN in aWk.Worksheets.Names)
if (aN.RefersTo != null)

If I use this test the Names collection seems to fall in some trouble when I clone worksheets in a workbook

Here you can find test code and find attached XLS for test:

Aspose.Cells.License c_license = new Aspose.Cells.License();
c_license.SetLicense(@“C:\Program Files (x86)\Aspose\Aspose.Cells\License\license.lic”);
int nullNames = 0;

Workbook aWk = new Workbook();
aWk.Open(@“C:\temp\prova.xls”);
aWk.Worksheets.Add(“SheetOne”);
aWk.Worksheets[“SheetOne”].Copy(aWk.Worksheets[0]);

StreamWriter aSw = new StreamWriter(“c:\temp\dumpNames.txt”);
aSw.WriteLine(“Correct !”);
foreach (Name aN in aWk.Worksheets.Names)
aSw.WriteLine(“Text:{0} R1C1RefersTo:{1} RefersTo:{2}”, aN.Text, aN.R1C1RefersTo, aN.RefersTo);
aSw.WriteLine("----");

aWk = new Workbook();
aWk.Open(@“C:\temp\prova.xls”);

foreach (Name aN in aWk.Worksheets.Names)
if (aN.RefersTo == null) // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
nullNames++;
aWk.Worksheets.Add(“SheetOne”);
aWk.Worksheets[“SheetOne”].Copy(aWk.Worksheets[0]);

aSw.WriteLine(“Wrong !! look at RefersTo property !”);
foreach (Name aN in aWk.Worksheets.Names)
aSw.WriteLine(“Text:{0} R1C1RefersTo:{1} RefersTo:{2}”, aN.Text, aN.R1C1RefersTo, aN.RefersTo);
aSw.WriteLine("----");

aSw.Close();
aSw.Dispose();

I’m using version 4.8.1.1 but the problem is the same with version 4.8.1.11

thanks
Paolo

Hi,

Thank you for considering Aspose.

We have found your mentioned issue after an initial test. We will look into it and get back to you soon. Your issue has been registered in our internal issue tracking system with issue id CELLSNET-13082.

Thank You & Best Regards,

Hi,

Thank you for considering Aspose.

Please download the latest version of Aspose.Cells for the following location and try it. We have fixed your mentioned issue.

Aspose.Cells for .NET (Latest Version)

Thank You & Best Regards,