ConditionalStyleCollectionClearFormatting Method

Clears all conditional styles of the table style.

Namespace:  Aspose.Words
Assembly:  Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntax
public void ClearFormatting()
Examples
Shows how to reset all table styles.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

// Create a table and give it conditional styling on border colors based on the row being the first or last
builder.StartTable();
builder.InsertCell();
builder.Write("First row");
builder.EndRow();
builder.InsertCell();
builder.Write("Last row");
builder.EndTable();

TableStyle tableStyle = (TableStyle)doc.Styles.Add(StyleType.Table, "MyTableStyle1");
tableStyle.ConditionalStyles.FirstRow.Borders.Color = Color.Red;
tableStyle.ConditionalStyles.LastRow.Borders.Color = Color.Blue;

// You can reset styles from the specific table area
tableStyle.ConditionalStyles[0].ClearFormatting();
Assert.AreEqual(Color.Empty, tableStyle.ConditionalStyles.FirstRow.Borders.Color);

// Or clear all table styles
tableStyle.ConditionalStyles.ClearFormatting();
Assert.AreEqual(Color.Empty, tableStyle.ConditionalStyles.LastRow.Borders.Color);
See Also