ConditionalStyleCollectionClearFormatting Method |
Namespace: Aspose.Words
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);