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.
I responded to this here: Applying Formula Results In #N/A - Infragistics Community
I'm Having this same issue. I'm creating the the excel file on my own using the Infragistics.Excel assembly. I've even simplified the formula to
dim f as Formula = Formula.Parse("=if(1>1, 0, 1)", CellReferenceMode.R1C1) f.ApplyTo(worksheet.rows(1).cells(1))
And it gives me the "=N/A" error
It's difficult to answer your question without more information. How are you using this formula? To what is it being applied? Are you using a WinGrid or create an Excel file on your own using the Infragistics.Excel assembly?
How is this related to the other posts in this thread?
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]);