private static void SetRowStyle(TableRow row, Color highlightColor, bool bold, bool italic) { foreach (var cell in row) { cell.BackgroundColor = highlightColor; foreach (var node in cell.GetChildNodes()) { node.ParagraphStyle.IsBold = bold; node.ParagraphStyle.IsItalic = italic; foreach (var style in node.Styles) { style.IsBold = bold; style.IsItalic = italic; } } } } [STAThread] public static void Main() { string dataDir = RunExamples.GetDataDir_Tables(); // Load the document into Aspose.Note. Document document = new Document(dataDir + "ChangeTableStyleIn.one"); // Get a list of table nodes IList nodes = document.GetChildNodes
(); foreach (Table table in nodes) { SetRowStyle(table.First(), Color.DarkGray, true, true); // Highlight first row after head. var flag = false; foreach (var row in table.Skip(1)) { SetRowStyle(row, flag ? Color.LightGray : Color.Empty, false, false); flag = !flag; } } document.Save(Path.Combine(dataDir, "ChangeTableStyleOut.one")); }