DocumentExpandTableStylesToDirectFormatting Method |
Namespace: Aspose.Words
This method exists because this version of Aspose.Words provides only limited support for table styles (see below). This method might be useful when you load a DOCX or WordprocessingML document that contains tables formatted with table styles and you need to query formatting of tables, cells, paragraphs or text.
This version of Aspose.Words provides limited support for table styles as follows:
Document doc = new Document(MyDir + "Tables.docx"); // Get the first cell of the first table in the document Table table = (Table) doc.GetChild(NodeType.Table, 0, true); Cell firstCell = table.FirstRow.FirstCell; // First print the color of the cell shading. This should be empty as the current shading // is stored in the table style double cellShadingBefore = table.FirstRow.RowFormat.Height; Console.WriteLine("Cell shading before style expansion: " + cellShadingBefore); // Expand table style formatting to direct formatting doc.ExpandTableStylesToDirectFormatting(); // Now print the cell shading after expanding table styles. A blue background pattern color // should have been applied from the table style double cellShadingAfter = table.FirstRow.RowFormat.Height; Console.WriteLine("Cell shading after style expansion: " + cellShadingAfter); doc.Save(ArtifactsDir + "Document.TableStyleToDirectFormatting.docx");