ConditionalFormattingIconCollection

ConditionalFormattingIconCollection class

Representerar en samling avConditionalFormattingIcon objekt.

public class ConditionalFormattingIconCollection : CollectionBase<ConditionalFormattingIcon>

Egenskaper

namnBeskrivning
Capacity { get; set; }
Count { get; }
Item { get; }Hämtar ConditionalFormattingIcon-elementet vid det angivna indexet.
Item { get; set; }

Metoder

namnBeskrivning
Add(ConditionalFormattingIcon)Lägger tillConditionalFormattingIcon objekt.
Add(IconSetType, int)Lägger tillConditionalFormattingIcon 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)

Exempel


[C#]

//Instantiering av ett arbetsboksobjekt
Workbook workbook = new Workbook();

Worksheet sheet = workbook.Worksheets[0];

//Hämta villkorlig formatering
ConditionalFormattingCollection cformattings = sheet.ConditionalFormattings;

//Lägger till en tom villkorlig formatering
int index = cformattings.Add();

//Få ny tillagd villkorlig formatering
FormatConditionCollection fcs = cformattings[index];

//Ställer in det villkorliga formatintervallet.
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);

//Ställer in villkor
 int idx = fcs.AddCondition(FormatConditionType.IconSet);
 
 FormatCondition cond = fcs[idx];
   
 //Ställer in villkor's type
 cond.IconSet.Type = IconSetType.ArrowsGray3;

//Lägg till anpassade ikonuppsättningsvillkor.
 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;

//Spara Excel-filen
workbook.Save("output.xls");

[VB.NET]

'Instantiera ett arbetsboksobjekt
Dim workbook As Workbook = New Workbook()

Dim sheet As Worksheet = workbook.Worksheets(0)

'Skaffa villkorlig formatering
Dim cformattings As ConditionalFormattingCollection = sheet.ConditionalFormattings

'Lägger till en tom villkorlig formatering
Dim index As Integer = cformattings.Add()

' ny tillagd villkorlig formatering
Dim fcs As FormatConditionCollection = cformattings(index)

'Ställer in det villkorliga formatintervallet.
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)

//Ställer in villkor
Dim idx As Integer =fcs.AddCondition(FormatConditionType.IconSet)

Dim cond As FormatCondition=fcs[idx]

//Ställer in villkor's type
cfIcon.Type = IconSetType.ArrowsGray3

'Lägg till anpassat ikonuppsättningsvillkor.
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

'Sparar Excel-filen
workbook.Save("output.xls")

Se även