Search code examples
c#type-conversionasposeaspose-cells

Convert string to Aspose.Cells.Name


I am trying to check, if the name of the sheet already is in the other workbook. I am currently trying it like this:

if (tempWb.Worksheets.Names.Contains(ibbWs.Worksheets[index].Name))
{
...
}

How can I fix that or convert a string into a Aspose.Cells.Name object?


Solution

  • You may simply check whether a given Name is null or not, so you may write your own code accordingly for your needs. See the sample code segment for your reference: e.g

    Sample code:

    ------------
    Name name = workbook.Worksheets.Names["yournamestring"];
    if (name == null)
                        Debug.WriteLine("Not found");
                    else
                        Debug.WriteLine("found" );
                        //...........Your code goes here.
      -------
    

    PS. I am working as Support developer/ Evangelist at Aspose.