Beispiel #1
0
        public void CreationParagraphsWithRectangleShape()
        {
            WordServerDocument doc      = new WordServerDocument();
            string             filePath = $"{s_BasePath}\\rectangle-shape.docx";

            File.Delete(filePath);
            Assert.AreEqual(doc.Create($"{s_BasePath}\\rectangle-shape.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("This text without format", new List <string>());

            doc.StartParagraph();
            doc.AddText("Inline text. ", new List <string>());

            doc.EndParagraph();

            for (var i = 0; i < 4; i++)
            {
                doc.StartParagraph();
                doc.AddShapeWithText("", "R" + i, 1.5, 1, (-0.4 * i), (0.15 * i), new List <string>()
                {
                    "strokewidth:1",
                    "color:red",
                    "fillcolor:white"
                });
                doc.AddText("This text without format for line: " + i, new List <string>());
                doc.EndParagraph();
            }

            doc.AddShapeWithText("", "SQUARE", 3, 3, 0, 0, new List <string>()
            {
                "strokewidth:5",
                "color:#32a852",
                "fillcolor:silver"
            }
                                 , new List <string>()
            {
                "fontsize:30",
                "color:red"
            });

            doc.AddRuledLine(10);
            doc.AddShapeWithText("", "SQUARE2", 3, 3, 0, 0, new List <string>()
            {
                "strokewidth:4",
                "color:blue"
            }
                                 , new List <string>()
            {
                "fontsize:30",
                "color:#32a852"
            });


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