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
70
Exporting excel formulas
posted

Hi, I'm trying to export to one excel document some data in a DataTable using Infragistics.Excel, and I would like to export some formulas (for example for the summaries..).

Example:

------------------------------------------------------------------------------------------------------------------------------------------------------

Workbook wb = new Infragistics.Excel.Workbook(Infragistics.Excel.WorkbookPaletteMode.CustomPalette);
Worksheet ws = wb.Worksheets.Add("WorkSheet");

int i = 0;

 for(i=0; i<10; i++) {

      ws.Rows[1].Cells[i].Value = "NIGHT";

}

Infragistics.Excel.Formula formula = Infragistics.Excel.Formula.Parse("=COUNT.IF($A12:$E12;\"NIGHT\")", CellReferenceMode.R1C1);
formula.ApplyTo(ws.Rows[1].Cells[i+1]);

----------------------------------------------------------------------------------------------------------------------------------------------

Thowing an exception when try to apply formula: "The formula has extra expressions after the end of it.Portion with error: ($A12:$E12;"NIGHT")"

 What is wrong?

 Thanks.

 Jacobo.

Parents
  • 469350
    Verified Answer
    Offline posted

    Hi Jacobo,

    For one thing, your formula is using A1 notation and you are specifying R1C1 as your CellReferenceMode. So that's a contradication. 

    Also, you are using a semi-colon instead of a comma to separate the arguments of your function. 

     

Reply Children