ApiExamples.ExStyles.CopyStyleDifferentDocument C# (CSharp) Метод

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

private CopyStyleDifferentDocument ( ) : void
Результат void
        public void CopyStyleDifferentDocument()
        {
            Document dstDoc = new Document();
            Document srcDoc = new Document();

            //ExStart
            //ExFor:StyleCollection.AddCopy
            //ExSummary:Demonstrates how to copy style from one document into a different document.
            // This is the style in the source document to copy to the destination document.
            Style srcStyle = srcDoc.Styles[StyleIdentifier.Heading1];

            // Change the font of the heading style to red.
            srcStyle.Font.Color = Color.Red;

            // The AddCopy method can be used to copy a style from a different document.
            Style newStyle = dstDoc.Styles.AddCopy(srcStyle);
            //ExEnd

            Assert.NotNull(newStyle);
            Assert.AreEqual("Heading 1", newStyle.Name);
            Assert.AreEqual(Color.Red.ToArgb(), newStyle.Font.Color.ToArgb());
        }