Hi Team,
I am using below code to apply conditional formatting.
FarPoint.Web.Spread.NamedStyle ns = new NamedStyle();
ns.BackColor = System.Drawing.Color.Red;
FarPoint.Web.Spread.NamedStyle ng = new NamedStyle();
ng.BackColor = System.Drawing.Color.Yellow;
FarPoint.Web.Spread.NamedStyle nc = new NamedStyle();
nc.BackColor = System.Drawing.Color.Honeydew;
FPSpread1.NamedStyles.Add(ns);
FPSpread1.NamedStyles.Add(ng);
FPSpread1.NamedStyles.Add(nc);
FPSpread1.ActiveSheetView.Columns[18].HorizontalAlign = HorizontalAlign.Right;
FPSpread1.ActiveSheetView.SetConditionalFormat(-1, 18, ns, FarPoint.Web.Spread.ComparisonOperator.EqualTo, "neg GP$");
FPSpread1.ActiveSheetView.SetConditionalFormat(-1, 18, nc, FarPoint.Web.Spread.ComparisonOperator.NotEqualTo, "neg GP$");
FPSpread1.ActiveSheetView.SetConditionalFormat(-1, 19, nc, FarPoint.Web.Spread.ComparisonOperator.LessThan, "1");
FPSpread1.ActiveSheetView.SetConditionalFormat(-1, 19, ng, FarPoint.Web.Spread.ComparisonOperator.Between, "1", "2");
FPSpread1.ActiveSheetView.SetConditionalFormat(-1, 19, ns, FarPoint.Web.Spread.ComparisonOperator.GreaterThan, "2");
FPSpread1.ActiveSheetView.SetConditionalFormat(-1, 29, ns, FarPoint.Web.Spread.ComparisonOperator.GreaterThan, "0");
When I export the control to excel these formula get applied to other column.
For example, formula applied in column 18 (starting from 0) get applied to column 17. The formula applied to column 29 (last column) don’t even get applied in excel.
Below is the code I am using to export the data.
Response.ContentType = "application/vnd.ms-excel";
Response.AddHeader("content-disposition", "attachment; filename=\" " + "ProductPlanning_" + rdbType.SelectedItem.Text + "_" + ddlPromotionname.SelectedItem.Text + "_" + ddlDivision.SelectedItem.Text + "_" + ddlYear.SelectedItem.Text + "_" + ddlWeek.SelectedItem.Text + "_" + DateTime.Now.Date.ToString("ddMMyy") + ".xls" + "\"");
System.IO.Stream sm = Page.Response.OutputStream;
FPSpread1.ActiveSheetView.SheetName = "Product Planning - " + rdbType.SelectedItem.Text;
FPSpread1.ActiveSheetView.Protect = false;
FPSpread1.SaveExcel(sm, FarPoint.Excel.ExcelSaveFlags.SaveCustomColumnHeaders);
sm.Flush();
Please let me know the steps in order to resolve this issue.