ConditionalStyleCollection Class |
Namespace: Aspose.Words
The ConditionalStyleCollection type exposes the following members.
Name | Description | |
---|---|---|
![]() ![]() | BottomLeftCell |
Gets the bottom left cell style.
|
![]() ![]() | BottomRightCell |
Gets the bottom right cell style.
|
![]() ![]() | Count |
Gets the number of conditional styles in the collection.
|
![]() ![]() | EvenColumnBanding |
Gets the even column banding style.
|
![]() ![]() | EvenRowBanding |
Gets the even row banding style.
|
![]() ![]() | FirstColumn |
Gets the first column style.
|
![]() ![]() | FirstRow |
Gets the first row style.
|
![]() ![]() | ItemInt32 |
Retrieves a ConditionalStyle object by index.
|
![]() ![]() | ItemConditionalStyleType |
Retrieves a ConditionalStyle object by conditional style type.
|
![]() ![]() | LastColumn |
Gets the last column style.
|
![]() ![]() | LastRow |
Gets the last row style.
|
![]() ![]() | OddColumnBanding |
Gets the odd column banding style.
|
![]() ![]() | OddRowBanding |
Gets the odd row banding style.
|
![]() ![]() | TopLeftCell |
Gets the top left cell style.
|
![]() ![]() | TopRightCell |
Gets the top right cell style.
|
Name | Description | |
---|---|---|
![]() ![]() | ClearFormatting |
Clears all conditional styles of the table style.
|
![]() | Equals | (Inherited from Object.) |
![]() ![]() | GetEnumerator |
Returns an enumerator object that can be used to iterate over all conditional styles in the collection.
|
![]() | GetHashCode | (Inherited from Object.) |
![]() | GetType | (Inherited from Object.) |
![]() | ToString | (Inherited from Object.) |
Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); // Create a table, which we will partially style Table table = builder.StartTable(); builder.InsertCell(); builder.Write("Cell 1, to be formatted"); builder.InsertCell(); builder.Write("Cell 2, to be formatted"); builder.EndRow(); builder.InsertCell(); builder.Write("Cell 3, to be left unformatted"); builder.InsertCell(); builder.Write("Cell 4, to be left unformatted"); builder.EndTable(); TableStyle tableStyle = (TableStyle)doc.Styles.Add(StyleType.Table, "MyTableStyle1"); // There is a different ways how to get conditional styles: // by conditional style type tableStyle.ConditionalStyles[ConditionalStyleType.FirstRow].Shading.BackgroundPatternColor = Color.AliceBlue; // by index tableStyle.ConditionalStyles[0].Borders.Color = Color.Black; tableStyle.ConditionalStyles[0].Borders.LineStyle = LineStyle.DotDash; Assert.AreEqual(ConditionalStyleType.FirstRow, tableStyle.ConditionalStyles[0].Type); // directly from ConditionalStyleCollection tableStyle.ConditionalStyles.FirstRow.ParagraphFormat.Alignment = ParagraphAlignment.Center; // To see this in Word document select Total Row checkbox in Design Tab tableStyle.ConditionalStyles.LastRow.BottomPadding = 10; tableStyle.ConditionalStyles.LastRow.LeftPadding = 10; tableStyle.ConditionalStyles.LastRow.RightPadding = 10; tableStyle.ConditionalStyles.LastRow.TopPadding = 10; // To see this in Word document select Last Column checkbox in Design Tab tableStyle.ConditionalStyles.LastColumn.Font.Bold = true; // List all possible style conditions using (IEnumerator<ConditionalStyle> enumerator = tableStyle.ConditionalStyles.GetEnumerator()) { while (enumerator.MoveNext()) { ConditionalStyle currentStyle = enumerator.Current; if (currentStyle != null) Console.WriteLine(currentStyle.Type); } } // Apply conditional style to the table and save table.Style = tableStyle; doc.Save(ArtifactsDir + "Table.WorkWithTableConditionalStyles.docx");