ConditionalFormattingIconCollection

ConditionalFormattingIconCollection class

Repräsentiert eine Sammlung vonConditionalFormattingIcon Objekte.

public class ConditionalFormattingIconCollection : CollectionBase<ConditionalFormattingIcon>

Eigenschaften

NameBeschreibung
Capacity { get; set; }
Count { get; }
Item { get; }Ruft das ConditionalFormattingIcon-Element am angegebenen Index ab.
Item { get; set; }

Methoden

NameBeschreibung
Add(ConditionalFormattingIcon)Fügt hinzuConditionalFormattingIcon Objekt.
Add(IconSetType, int)Fügt hinzuConditionalFormattingIcon Objekt.
BinarySearch(ConditionalFormattingIcon)
BinarySearch(ConditionalFormattingIcon, IComparer<ConditionalFormattingIcon>)
BinarySearch(int, int, ConditionalFormattingIcon, IComparer<ConditionalFormattingIcon>)
Clear()
Contains(ConditionalFormattingIcon)
CopyTo(ConditionalFormattingIcon[])
CopyTo(ConditionalFormattingIcon[], int)
CopyTo(int, ConditionalFormattingIcon[], int, int)
Exists(Predicate<ConditionalFormattingIcon>)
Find(Predicate<ConditionalFormattingIcon>)
FindAll(Predicate<ConditionalFormattingIcon>)
FindIndex(Predicate<ConditionalFormattingIcon>)
FindIndex(int, Predicate<ConditionalFormattingIcon>)
FindIndex(int, int, Predicate<ConditionalFormattingIcon>)
FindLast(Predicate<ConditionalFormattingIcon>)
FindLastIndex(Predicate<ConditionalFormattingIcon>)
FindLastIndex(int, Predicate<ConditionalFormattingIcon>)
FindLastIndex(int, int, Predicate<ConditionalFormattingIcon>)
GetEnumerator()
IndexOf(ConditionalFormattingIcon)
IndexOf(ConditionalFormattingIcon, int)
IndexOf(ConditionalFormattingIcon, int, int)
LastIndexOf(ConditionalFormattingIcon)
LastIndexOf(ConditionalFormattingIcon, int)
LastIndexOf(ConditionalFormattingIcon, int, int)
RemoveAt(int)

Beispiele


[C#]

//Instanziieren eines Workbook-Objekts
Workbook workbook = new Workbook();

Worksheet sheet = workbook.Worksheets[0];

//Bedingte Formatierung abrufen
ConditionalFormattingCollection cformattings = sheet.ConditionalFormattings;

//Fügt eine leere bedingte Formatierung hinzu
int index = cformattings.Add();

//Neu hinzugefügte bedingte Formatierung abrufen
FormatConditionCollection fcs = cformattings[index];

//Legt den bedingten Formatbereich fest.
CellArea ca = new CellArea();

ca.StartRow = 0;

ca.EndRow = 0;

ca.StartColumn = 0;

ca.EndColumn = 0;

fcs.AddArea(ca);

ca = new CellArea();

ca.StartRow = 1;

ca.EndRow = 1;

ca.StartColumn = 1;

ca.EndColumn = 1;

fcs.AddArea(ca);

// Setzt die Bedingung
 int idx = fcs.AddCondition(FormatConditionType.IconSet);
 
 FormatCondition cond = fcs[idx];
   
 // Setzt die Bedingung's type
 cond.IconSet.Type = IconSetType.ArrowsGray3;

// Benutzerdefinierte Iconset-Bedingung hinzufügen.
 ConditionalFormattingIcon cfIcon = cond.IconSet.CfIcons[0];
 
 cfIcon.Type = IconSetType.Arrows3;
 
 cfIcon.Index = 0;
 
 ConditionalFormattingIcon cfIcon1 = cond.IconSet.CfIcons[1];
 
  cfIcon1.Type = IconSetType.ArrowsGray3;
  
  cfIcon1.Index = 1;
  
  ConditionalFormattingIcon cfIcon2 = cond.IconSet.CfIcons[2];
  
  cfIcon2.Type = IconSetType.Boxes5;
  
  cfIcon2.Index = 2;

//Speichern der Excel-Datei
workbook.Save("output.xls");

[VB.NET]

'Instanziieren eines Workbook-Objekts
Dim workbook As Workbook = New Workbook()

Dim sheet As Worksheet = workbook.Worksheets(0)

'Holen Sie sich die bedingte Formatierung
Dim cformattings As ConditionalFormattingCollection = sheet.ConditionalFormattings

'Fügt eine leere bedingte Formatierung hinzu
Dim index As Integer = cformattings.Add()

'Holen Sie sich die neu hinzugefügte bedingte Formatierung
Dim fcs As FormatConditionCollection = cformattings(index)

'Legt den bedingten Formatbereich fest.
Dim ca As New CellArea()

ca.StartRow = 0

ca.EndRow = 0

ca.StartColumn = 0

ca.EndColumn = 0

fcs.AddArea(ca)

ca = New CellArea()

ca.StartRow = 1

ca.EndRow = 1

ca.StartColumn = 1

ca.EndColumn = 1

fcs.AddArea(ca)

// Setzt die Bedingung
Dim idx As Integer =fcs.AddCondition(FormatConditionType.IconSet)

Dim cond As FormatCondition=fcs[idx]

// Setzt die Bedingung's type
cfIcon.Type = IconSetType.ArrowsGray3

'Fügen Sie eine benutzerdefinierte Iconset-Bedingung hinzu.
Dim cfIcon As ConditionalFormattingIcon = cond.IconSet.CfIcons[0]

cfIcon.Type = IconSetType.Arrows3

cfIcon.Index=0

Dim cfIcon1 As ConditionalFormattingIcon = cond.IconSet.CfIcons[1]

cfIcon1.Type = IconSetType.ArrowsGray3

cfIcon1.Index=1

Dim cfIcon2 As ConditionalFormattingIcon = cond.IconSet.CfIcons[2]

cfIcon2.Type = IconSetType.Boxes5

cfIcon2.Index=2

'Speichern der Excel-Datei
workbook.Save("output.xls")

Siehe auch