GrapeCity Forums

The GrapeCity Message Boards
Welcome to GrapeCity Forums Sign in | Join | Help
in Search

conditional formating on export to excel error

Last post 02-09-2010, 5:01 PM by SureshD. 1 replies.
Sort Posts: Previous Next
  •  02-09-2010, 4:34 AM 87170

    conditional formating on export to excel error

    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.

     

  •  02-09-2010, 5:01 PM 87194 in reply to 87170

    Re: conditional formating on export to excel error

    Hello,

    What  version of Spread are you using? A similar issue was reported as bug# 22484 in the past, which has been fixed. In case you are using an older version of Spread, please upgrade to the latest one and test the issue. You can download the latest available build from following location:

     http://www.clubfarpoint.com/FarPointSupportSite/Modules/Download/updates.aspx

    Thanks


    Suresh Singh Dasila
    GrapeCity FarPoint
View as RSS news feed in XML
     FarPoint Forums Home