IRONSOFTWAREHOME
Excel Bedingte Formatierung
using IronXL;
using IronXL.Formatting.Enums;
using IronXL.Styles;

WorkBook workBook = WorkBook.Load("sample.xlsx");
WorkSheet workSheet = workBook.DefaultWorkSheet;

// Create conditional formatting rule
var rule = workSheet.ConditionalFormatting.CreateConditionalFormattingRule(ComparisonOperator.LessThan, "8");
// Set style options
rule.FontFormatting.IsBold = true;
rule.FontFormatting.FontColor = "#123456";
rule.BorderFormatting.RightBorderColor = "#ffffff";
rule.BorderFormatting.RightBorderType = BorderType.Thick;
rule.PatternFormatting.BackgroundColor = "#54bdd9";
rule.PatternFormatting.FillPattern = FillPattern.Diamonds;
// Apply formatting on specified region
workSheet.ConditionalFormatting.AddConditionalFormatting("A3:A8", rule);

// Create conditional formatting rule
var rule1 = workSheet.ConditionalFormatting.CreateConditionalFormattingRule(ComparisonOperator.Between, "7", "10");
// Set style options
rule1.FontFormatting.IsItalic = true;
rule1.FontFormatting.UnderlineType = FontUnderlineType.Single;
// Apply formatting on specified region
workSheet.ConditionalFormatting.AddConditionalFormatting("A3:A9", rule1);

workBook.SaveAs("applyConditionalFormatting.xlsx");
Imports IronXL
Imports IronXL.Formatting.Enums
Imports IronXL.Styles

Dim workBook As WorkBook = WorkBook.Load("sample.xlsx")
Dim workSheet As WorkSheet = workBook.DefaultWorkSheet

' Create conditional formatting rule
Dim rule = workSheet.ConditionalFormatting.CreateConditionalFormattingRule(ComparisonOperator.LessThan, "8")
' Set style options
rule.FontFormatting.IsBold = True
rule.FontFormatting.FontColor = "#123456"
rule.BorderFormatting.RightBorderColor = "#ffffff"
rule.BorderFormatting.RightBorderType = BorderType.Thick
rule.PatternFormatting.BackgroundColor = "#54bdd9"
rule.PatternFormatting.FillPattern = FillPattern.Diamonds
' Apply formatting on specified region
workSheet.ConditionalFormatting.AddConditionalFormatting("A3:A8", rule)

' Create conditional formatting rule
Dim rule1 = workSheet.ConditionalFormatting.CreateConditionalFormattingRule(ComparisonOperator.Between, "7", "10")
' Set style options
rule1.FontFormatting.IsItalic = True
rule1.FontFormatting.UnderlineType = FontUnderlineType.Single
' Apply formatting on specified region
workSheet.ConditionalFormatting.AddConditionalFormatting("A3:A9", rule1)

workBook.SaveAs("applyConditionalFormatting.xlsx")
NuGet Download
PM > Install-Package IronXL.Excel
Excel Bedingte Formatierung

Excel Bedingte Formatierung

Die IronXL-Bibliothek unterstützt die Bedingte Formatierung von Zellen und Bereichen. Bedingte Formatierung ermöglicht das Ändern des Stils der Zelle, wie z.B. der Hintergrundfarbe oder des Schriftstils, basierend auf logischen/programmierten Regeln.

Verwenden Sie CreateConditionalFormattingRule(string formula), um eine bedingte Formatierungsregel basierend auf einer Boolean-Formel zu erstellen. Wenn das Formelergebnis wahr ist, wird die Zelle hervorgehoben. Bitte beachten Sie, dass die zu bewertende Formel MUSS eine boolesche Funktion sein.

Die CreateConditionalFormattingRule Methode mit drei Parametern kann nur ComparisonOperator.Between und ComparisonOperator.NotBetween als ersten Parameter akzeptieren.

Verwenden Sie bedingte Formatierung, um Zellen und Bereiche mit angegebenen Farb- und Formatkombinationen hervorzuheben, die von dem durch festgelegte Regeln bestimmten Wahrheitswert der Zelle abhängen. Dies ermöglicht die Fähigkeit, Daten zu analysieren, Probleme zu erkennen und Muster und Trends zu identifizieren.

Lernen Sie, bedingte Formatierungen in C# anzuwenden
Auf GitHub ansehen

Bereit anzufangen?

Nuget Downloads 2,280,941Version:2026.10gerade veröffentlicht

Key in blue circle

Holen Sie sich sofort Ihren kostenlosen 30-Tage-Testschlüssel.

Your trial license will be sent to your email address

Keine Einschränkungen. 100 % freigeschaltet. Keine Kreditkarte.

bullet_checkedIhr Testlizenzschlüssel wurde Ihnen per E-Mail gesendet.Keine Einschränkungen. 100 % freigeschaltet. Keine Kreditkarte.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronXL
AWS-Logo
Booking Badge

Von Millionen von Ingenieur*innen weltweit vertraut

Azure (WebApps, Funktionen v3)
Erhalten Sie Ihre unverbindliche Beratung
Ihre Daten werden immer vertraulich behandelt.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Von Millionen von Ingenieur*innen weltweit vertraut
Erhalten Sie sofort Ihren kostenlosen 30-Tage-Testschlüssel.
Ihr Testlizenzschlüssel wurde Ihnen per E-Mail gesendet.
C# NuGet-Bibliothek für PDF
Installation mit NuGet

Version: 2026.10

PM > Install-Package IronXL.Excel
nuget.org/packages/IronXL.Excel/
  1. Rechtsklick auf Referenzen, NuGet-Pakete verwalten
  2. Wählen Sie Durchsuchen und suchen Sie "IronXL"
  3. Paket auswählen und installieren
C# PDF DLL
Download DLL

Version: 2026.10

  1. Laden Sie IronXL herunter und entpacken Sie es an einem Ort wie ~/Libs innerhalb Ihres Solution-Verzeichnisses
  2. Klicken Sie im Visual Studio Solution Explorer mit der rechten Maustaste auf Referenzen. Wählen Sie Durchsuchen, "IronXL.dll"

Lizenzen ab $999