ConditionalFormattingIconCollection

ConditionalFormattingIconCollection class

Representa una colección deConditionalFormattingIcon objetos.

public class ConditionalFormattingIconCollection : CollectionBase<ConditionalFormattingIcon>

Propiedades

NombreDescripción
Capacity { get; set; }
Count { get; }
Item { get; }Obtiene el elemento ConditionalFormattingIcon en el índice especificado.
Item { get; set; }

Métodos

NombreDescripción
Add(ConditionalFormattingIcon)AgregaConditionalFormattingIcon objeto.
Add(IconSetType, int)AgregaConditionalFormattingIcon objeto.
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)

Ejemplos


[C#]

// Instanciando un objeto Workbook
Workbook workbook = new Workbook();

Worksheet sheet = workbook.Worksheets[0];

//Obtener formato condicional
ConditionalFormattingCollection cformattings = sheet.ConditionalFormattings;

//Agrega un formato condicional vacío
int index = cformattings.Add();

// Obtener el formato condicional recién agregado
FormatConditionCollection fcs = cformattings[index];

//Establece el rango de formato condicional.
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);

// Establece la condición
 int idx = fcs.AddCondition(FormatConditionType.IconSet);
 
 FormatCondition cond = fcs[idx];
   
 // Establece la condición's type
 cond.IconSet.Type = IconSetType.ArrowsGray3;

// Agregar condición de conjunto de iconos personalizado.
 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;

//Guardando el archivo de Excel
workbook.Save("output.xls");

[VB.NET]

'Crear una instancia de un objeto Workbook
Dim workbook As Workbook = New Workbook()

Dim sheet As Worksheet = workbook.Worksheets(0)

'Obtener formato condicional
Dim cformattings As ConditionalFormattingCollection = sheet.ConditionalFormattings

'Agrega un formato condicional vacío
Dim index As Integer = cformattings.Add()

'Obtenga el formato condicional recién agregado
Dim fcs As FormatConditionCollection = cformattings(index)

'Establece el rango de formato condicional.
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)

// Establece la condición
Dim idx As Integer =fcs.AddCondition(FormatConditionType.IconSet)

Dim cond As FormatCondition=fcs[idx]

// Establece la condición's type
cfIcon.Type = IconSetType.ArrowsGray3

'Agregue una condición de conjunto de iconos personalizado.
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

'Guardar el archivo de Excel
workbook.Save("output.xls")

Ver también