IRONSOFTWAREHOME
Excel Bedingte Formatierung
from ironxl import *

# Load existing spreadsheet
workbook = WorkBook.Load("sample.xlsx")
worksheet = workbook.DefaultWorkSheet

# Create conditional formatting rule
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 the specified region
worksheet.ConditionalFormatting.AddConditionalFormatting("A3:A8", rule)

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

# Save changes with applied conditional formatting
workbook.SaveAs("applyConditionalFormatting.xlsx")
pip install ironxl
Excel Bedingte Formatierung

Excel Bedingte Formatierung

IronXL for Python unterstützt bedingte Formatierung von Zellen und Bereichen. Die bedingte Formatierung ändert den Stil einer Zelle – wie z.B. Hintergrundfarbe oder Textformatierung – basierend auf logischen oder programmatischen Regeln.

Verwenden Sie CreateConditionalFormattingRule(formula), um eine Regel zur bedingten Formatierung basierend auf einem booleschen Ausdruck zu erstellen. Wenn die Formel zu True ausgewertet wird, wird die Zelle hervorgehoben. Die bereitgestellte Formel muss ein boolesches Ergebnis zurückgeben.

Die Überladung mit drei Parametern von CreateConditionalFormattingRule akzeptiert nur ComparisonOperator.Between oder ComparisonOperator.NotBetween als ersten Parameter.

Die bedingte Formatierung ermöglicht es Entwicklern, Zellen und Bereiche mit spezifischen Farb- und Formatkombinationen hervorzuheben, abhängig vom Wert jeder Zelle. Dies macht es einfach, Daten zu analysieren, Probleme zu erkennen und Muster und Trends direkt innerhalb der Excel-Datei zu identifizieren.

Lernen Sie, wie man die bedingte Formatierung in Python anwendet

Bereit anzufangen?

Version:2026.9gerade 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 IronPDF
AWS-Logo
Booking Badge

Von Millionen von Ingenieur*innen weltweit vertraut

Azure (WebApps, Funktionen v3)
Erhalten Sie Ihre unverbindliche Beratung
Füllen Sie das Formular unten aus oder senden Sie eine E-Mail an sales@ironsoftware.com
Ihre Daten werden immer vertraulich behandelt.
Von Millionen von Ingenieur*innen weltweit vertraut
Azure (WebApps, Funktionen v3)
Erhalten Sie sofort Ihren kostenlosen 30-Tage-Testschlüssel.
Ihr Testlizenzschlüssel wurde Ihnen per E-Mail gesendet.