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
80
How to create worksheets containing formulae?
posted

 I tried thisbriefly and it doesn't work as intended

            Infragistics.Excel.Workbook workbook = new Workbook();
           
            workbook.Worksheets.Add("test");
            Infragistics.Excel.Worksheet sheet = workbook.Worksheets[0];
            sheet.Rows[0].Cells[0].Value = 5.05;
            sheet.Rows[1].Cells[0].Value = "=A1+1";

when I wxport it to excel, A2 shows =A1+1, and I have to go into the cell and press enter again for it to update to 6.05, and pressing F9 doesn't update the cell. How can I do this properly? Thank you

Parents
No Data
Reply
  • 1922
    posted

    Hi,

    you need to parse the formula like this (untested!):

     

    Infragistics.Excel.Formula formula = Infragistics.Excel.Formula.Parse("=A1+1", Infragistics.Excel.CellReferenceMode.A1);

    Infragistics.Excel.WorksheetRegion region = new Infragistics.Excel.WorksheetRegion(sheet, 2,2,2,2); // check the parameters, I'm not sure about those!

    formula.ApplyTo(region);

     Hope that helps!

Children