Esempio n. 1
0
        public void CreationParagraphsWithProperties()
        {
            WordServerDocument doc = new WordServerDocument();

            Assert.AreEqual(doc.Create($"{s_BasePath}\\testFormats.docx", true, out _), OutputCode.OK);


            doc.AddText("Bold", new List <string>()
            {
                "bold"
            });
            doc.AddText("Italic", new List <string>()
            {
                "italic"
            });
            doc.AddText("FontSize 54", new List <string>()
            {
                "fontsize:54"
            });
            doc.AddText("color red italic", new List <string>()
            {
                "color:red", "italic"
            });
            doc.AddText("This text without format", new List <string>());


            doc.AddText("Bold", new List <string>()
            {
                "bold", "numbering"
            });
            doc.AddText("Italic", new List <string>()
            {
                "italic", "numbering"
            });
            doc.AddText("FontSize 54", new List <string>()
            {
                "fontsize:54", "numbering"
            });
            doc.AddText("color red italic", new List <string>()
            {
                "color:red", "italic", "numbering"
            });
            doc.AddText("This text without format", new List <string>());

            doc.AddText("Bold", new List <string>()
            {
                "bold", "numbering", "level:0"
            });
            doc.AddText("Italic", new List <string>()
            {
                "italic", "numbering", "level:1"
            });
            doc.AddText("FontSize 54", new List <string>()
            {
                "fontsize:54", "numbering", "level:1"
            });
            doc.AddText("color red italic", new List <string>()
            {
                "color:red", "italic", "numbering", "level:0"
            });
            doc.AddText("This text without format before page", new List <string>());

            doc.AddPageBreak();

            doc.AddText("Bold", new List <string>()
            {
                "bold", "bullet"
            });
            doc.AddText("Italic", new List <string>()
            {
                "italic", "bullet"
            });
            doc.AddText("FontSize 54", new List <string>()
            {
                "fontsize:54", "bullet"
            });
            doc.AddText("color red italic", new List <string>()
            {
                "color:red", "italic", "bullet"
            });
            doc.AddText("This text without format after page", new List <string>());

            doc.AddText("Bold", new List <string>()
            {
                "bold", "bullet", "level:0"
            });
            doc.AddText("Italic", new List <string>()
            {
                "italic", "bullet", "level:1"
            });
            doc.AddText("FontSize 54", new List <string>()
            {
                "fontsize:54", "bullet", "level:1"
            });
            doc.AddText("color red italic", new List <string>()
            {
                "color:red", "italic", "bullet", "level:2"
            });
            doc.AddText("This text without format", new List <string>());
            doc.AddRuledLine(60);


            doc.AddText("Bold", new List <string>()
            {
                "bold", "numbering"
            });
            doc.AddText("Italic", new List <string>()
            {
                "italic", "numbering"
            });
            doc.AddText("FontSize 54", new List <string>()
            {
                "fontsize:54", "numbering"
            });
            doc.AddText("color red italic", new List <string>()
            {
                "color:red", "italic", "numbering"
            });
            doc.AddText("This text without format", new List <string>());
            doc.AddText("          d                                                ", new List <string>()
            {
                "underline"
            });
            doc.AddRuledLine(40);


            doc.Save();
            doc.Close();
        }