Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
2700
Setting a name for a Cell
posted

Hi,

My application reads in a template excel file, performs some substitution of data and then writes out a formatted document using the Infragistics framework.  All fine so far but I want to add a name to specific cells so that they can be identified when the document is read back in. 

I know that I need to use

NamedReference cellNamedReference = cell.Worksheet.Workbook.NamedReferences.Add(cellName, rangeName);

however I'm having issues with the range name as I need to set the name for a specific cell.  In the WorkBookRow and WorkBookCell objects I have a row/column index however when creating the range name I need something similar to "=mysheet!$C$2" but the row index is a numeric not a character.  Now obviously I could convert the row number to a digit and use that but it seems odd that the row object does not have a name as it has in Excel.

Am I missing something here or do I just have to convert the index to a letter?

Parents
  • 53790
    posted

    Hello Chris,

    I try to reproduce your issue using our latest available version - 13.2.20132.2010 but without success. Could you please tell me what is your current version.  Here is my test code:

    Infragistics.Documents.Excel.Workbook wb = new Infragistics.Documents.Excel.Workbook();

    wb = Infragistics.Documents.Excel.Workbook.Load("..\\..\\T1.xlsx");

    Infragistics.Documents.Excel.Worksheet worksheet = wb.Worksheets["Sheet1"];

     

    NamedReference nameRefCell = wb.NamedReferences.Add("MyCell1001", "=Sheet1!$C$5", worksheet);

    NamedReference namerefRegion = wb.NamedReferences.Add("MyRegion1001", "=Sheet1!$D$4:$D$20", worksheet);

     wb.Save("..\\..\\T1.xlsx");

     Process.Start("..\\..\\T1.xlsx");

    Please take  a look on attached video file for more details and if you think that I didn`t reproduce your scenario, feel free to write me

    Let me know if you have any questions.

     

     

    Video872.rar
Reply Children
No Data