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.
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.
When i use the "=IF" formula in the code during export to excel apply formula, it throws an error "=#N/A"
=IF(P10 - Q10 + R10 < 0, 0, P10 - Q10 + R10)
It use to work in the previous version of infragistics (v7.3). We recently upgraded to the newer version(9.2 for .net3.5).
Is this a known bug?
Thanks for your help Mike. Now it works well.
Infragistics.Excel.Formula formula = Infragistics.Excel.Formula.Parse("=Countif(A12:E12,\"NIGHT\")", CellReferenceMode.A1);formula.ApplyTo(ws.Rows[1].Cells[i+1]);