# spreadsheet-advanced-conditional-formatting

> Spreadsheet populated with sales data featuring data bars, color scales and icon set rules applied to selected cell ranges.

**Framework:** winforms  **Component:** Spreadsheet  **Variant:** advanced-conditional-formatting

## Get this item

**If you are an agent, fetch the JSON.** Source is inlined, so one request is enough and no tooling is required:

```
GET https://ai.syncfusion.com/r/winforms/spreadsheet-advanced-conditional-formatting.json
```

**Install Package(s)**

```bash
dotnet add package Syncfusion.Spreadsheet.Windows
```

**Notes**

- Syncfusion release: 2026 Volume 3 (v35.1.37)
- The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md

## Source files

### src/components/spreadsheet-advanced-conditional-formatting/spreadsheet.Designer.cs

```cs
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using Syncfusion.Windows.Forms.Spreadsheet;

namespace AdvancedConditionalFormatting
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            this.spreadsheet = new Spreadsheet();
            this.spreadsheetRibbon = new SpreadsheetRibbon();
            this.SuspendLayout();
            //
            // spreadsheetRibbon
            //
            this.spreadsheetRibbon.Location = new System.Drawing.Point(0, 0);
            this.spreadsheetRibbon.Name = "spreadsheetRibbon";
            this.spreadsheetRibbon.Size = new System.Drawing.Size(1032, 150);
            this.spreadsheetRibbon.TabIndex = 1;
            //
            // spreadsheet
            //
            this.spreadsheet.Dock = System.Windows.Forms.DockStyle.Fill;
            this.spreadsheet.Name = "spreadsheet";
            this.spreadsheet.Size = new System.Drawing.Size(1032, 461);
            this.spreadsheet.TabIndex = 0;
            this.spreadsheet.Text = "spreadsheet";
            //
            // Form1
            //
            this.Controls.Add(this.spreadsheet);
            this.Controls.Add(this.spreadsheetRibbon);
            this.Icon = new System.Drawing.Icon(AdvancedConditionalFormattingDataSource.GetIconPath());
            this.Name = "Form1";
            this.Text = "Advanced Conditional Formatting";
            this.Load += new System.EventHandler(this.Form1_Load);
            this.ResumeLayout(true);

        }

        #endregion
    }
}

```

### src/components/spreadsheet-advanced-conditional-formatting/spreadsheet.cs

```cs
using System;
using System.Drawing;
using System.Windows.Forms;
using Syncfusion.Windows.Forms.Spreadsheet;
using Syncfusion.Windows.Forms.Tools;

namespace AdvancedConditionalFormatting
{
    /// <summary>
    /// Demonstrates the advanced conditional formatting support of the
    /// Syncfusion Spreadsheet control.
    /// </summary>
    public partial class Form1 : RibbonForm
    {
        private Spreadsheet spreadsheet;
        private SpreadsheetRibbon spreadsheetRibbon;

        public Form1()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Opens the workbook that ships with this sample.
        /// </summary>
        private void Form1_Load(object sender, EventArgs e)
        {
            string workbookPath = AdvancedConditionalFormattingDataSource.GetWorkbookPath();
            if (System.IO.File.Exists(workbookPath))
            {
                this.spreadsheet.Open(workbookPath);
            }
        }

        /// <summary>
        /// Provides support for an Excel-like closing operation when the close
        /// button is pressed.
        /// </summary>
        protected override void OnFormClosing(FormClosingEventArgs e)
        {
            if (e.CloseReason != CloseReason.ApplicationExitCall)
            {
                this.spreadsheet.Commands.FileClose.Execute(null);
                e.Cancel = true;
            }
            base.OnFormClosing(e);
        }
    }
}

```
