ConditionalFormattingIconCollection

ConditionalFormattingIconCollection class

Représente une collection deConditionalFormattingIcon objets.

public class ConditionalFormattingIconCollection : CollectionBase<ConditionalFormattingIcon>

Propriétés

NomLa description
Capacity { get; set; }
Count { get; }
Item { get; }Obtient l’élément ConditionalFormattingIcon à l’index spécifié.
Item { get; set; }

Méthodes

NomLa description
Add(ConditionalFormattingIcon)AjouteConditionalFormattingIcon objet.
Add(IconSetType, int)AjouteConditionalFormattingIcon objet.
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)

Exemples


[C#]

//Instanciation d'un objet Workbook
Workbook workbook = new Workbook();

Worksheet sheet = workbook.Worksheets[0];

//Obtenir la mise en forme conditionnelle
ConditionalFormattingCollection cformattings = sheet.ConditionalFormattings;

//Ajoute une mise en forme conditionnelle vide
int index = cformattings.Add();

//Obtenir la mise en forme conditionnelle nouvellement ajoutée
FormatConditionCollection fcs = cformattings[index];

// Définit la plage de format conditionnel.
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);

// Définit la condition
 int idx = fcs.AddCondition(FormatConditionType.IconSet);
 
 FormatCondition cond = fcs[idx];
   
 // Définit la condition's type
 cond.IconSet.Type = IconSetType.ArrowsGray3;

//Ajouter une condition de jeu d'icônes personnalisée.
 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;

//Enregistrement du fichier Excel
workbook.Save("output.xls");

[VB.NET]

'Instanciation d'un objet Workbook
Dim workbook As Workbook = New Workbook()

Dim sheet As Worksheet = workbook.Worksheets(0)

'Obtenir la mise en forme conditionnelle
Dim cformattings As ConditionalFormattingCollection = sheet.ConditionalFormattings

'Ajoute une mise en forme conditionnelle vide
Dim index As Integer = cformattings.Add()

'Obtenir la mise en forme conditionnelle nouvellement ajoutée
Dim fcs As FormatConditionCollection = cformattings(index)

'Définit la plage de format conditionnel.
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)

// Définit la condition
Dim idx As Integer =fcs.AddCondition(FormatConditionType.IconSet)

Dim cond As FormatCondition=fcs[idx]

// Définit la condition's type
cfIcon.Type = IconSetType.ArrowsGray3

'Ajouter une condition de jeu d'icônes personnalisée.
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

'Enregistrement du fichier Excel
workbook.Save("output.xls")

Voir également