ApiExamples.ExDocument.TableStyleToDirectFormatting C# (CSharp) Метод

TableStyleToDirectFormatting() приватный Метод

private TableStyleToDirectFormatting ( ) : void
Результат void
        public void TableStyleToDirectFormatting()
        {
            //ExStart
            //ExFor:Document.ExpandTableStylesToDirectFormatting
            //ExId:TableStyleToDirectFormatting
            //ExSummary:Shows how to expand the formatting from styles onto the rows and cells of the table as direct formatting.
            Document doc = new Document(MyDir + "Table.TableStyle.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);
            //ExEnd

            doc.Save(MyDir + @"\Artifacts\Table.ExpandTableStyleFormatting.docx");

            Assert.AreEqual(Color.Empty, cellShadingBefore);
            Assert.AreNotEqual(Color.Empty, cellShadingAfter);
        }
ExDocument