ConditionalStyleType Enumeration |
Represents possible table areas to which conditional formatting may be defined in a table style.
Namespace:
Aspose.Words
Assembly:
Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntaxpublic enum ConditionalStyleType
Public Enumeration ConditionalStyleType
public enum class ConditionalStyleType
type ConditionalStyleType
Members
| Member name | Value | Description |
---|
| FirstRow | 0 |
Specifies formatting of the first row of a table.
|
| FirstColumn | 1 |
Specifies formatting of the first column of a table.
|
| LastRow | 2 |
Specifies formatting of the last row of a table.
|
| LastColumn | 3 |
Specifies formatting of the last column of a table.
|
| OddRowBanding | 4 |
Specifies formatting of odd-numbered row stripe.
|
| OddColumnBanding | 5 |
Specifies formatting of odd-numbered column stripe.
|
| EvenRowBanding | 6 |
Specifies formatting of even-numbered row stripe.
|
| EvenColumnBanding | 7 |
Specifies formatting of even-numbered column stripe.
|
| TopLeftCell | 8 |
Specifies formatting of the top left cell of a table.
|
| TopRightCell | 9 |
Specifies formatting of the top right cell of a table.
|
| BottomLeftCell | 10 |
Specifies formatting of the bottom left cell of a table.
|
| BottomRightCell | 11 |
Specifies formatting of the bottom right cell of a table.
|
ExamplesShows how to work with certain area styles of a table.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
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");
tableStyle.ConditionalStyles[ConditionalStyleType.FirstRow].Shading.BackgroundPatternColor = Color.AliceBlue;
tableStyle.ConditionalStyles[0].Borders.Color = Color.Black;
tableStyle.ConditionalStyles[0].Borders.LineStyle = LineStyle.DotDash;
Assert.AreEqual(ConditionalStyleType.FirstRow, tableStyle.ConditionalStyles[0].Type);
tableStyle.ConditionalStyles.FirstRow.ParagraphFormat.Alignment = ParagraphAlignment.Center;
tableStyle.ConditionalStyles.LastRow.BottomPadding = 10;
tableStyle.ConditionalStyles.LastRow.LeftPadding = 10;
tableStyle.ConditionalStyles.LastRow.RightPadding = 10;
tableStyle.ConditionalStyles.LastRow.TopPadding = 10;
tableStyle.ConditionalStyles.LastColumn.Font.Bold = true;
using (IEnumerator<ConditionalStyle> enumerator = tableStyle.ConditionalStyles.GetEnumerator())
{
while (enumerator.MoveNext())
{
ConditionalStyle currentStyle = enumerator.Current;
if (currentStyle != null) Console.WriteLine(currentStyle.Type);
}
}
table.Style = tableStyle;
doc.Save(ArtifactsDir + "Table.WorkWithTableConditionalStyles.docx");
See Also