예제 #1
0
        public void TextBox()
        {
            //ExStart
            //ExFor:Drawing.LayoutFlow
            //ExSummary:Shows how to add text to a text box, and change its orientation
            Document        doc     = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            Shape textbox = new Shape(doc, ShapeType.TextBox)
            {
                Width   = 100,
                Height  = 100,
                TextBox = { LayoutFlow = LayoutFlow.BottomToTop }
            };

            textbox.AppendChild(new Paragraph(doc));
            builder.InsertNode(textbox);

            builder.MoveTo(textbox.FirstParagraph);
            builder.Write("This text is flipped 90 degrees to the left.");

            doc.Save(ArtifactsDir + "Drawing.TextBox.docx");
            //ExEnd

            doc     = new Document(ArtifactsDir + "Drawing.TextBox.docx");
            textbox = (Shape)doc.GetChild(NodeType.Shape, 0, true);

            Assert.AreEqual(ShapeType.TextBox, textbox.ShapeType);
            Assert.AreEqual(100.0d, textbox.Width);
            Assert.AreEqual(100.0d, textbox.Height);
            Assert.AreEqual(LayoutFlow.BottomToTop, textbox.TextBox.LayoutFlow);
            Assert.AreEqual("This text is flipped 90 degrees to the left.", textbox.GetText().Trim());
        }
예제 #2
0
        public void TextBoxTextLayout()
        {
            //ExStart
            //ExFor:Drawing.LayoutFlow
            //ExSummary:Shows how to add text to a textbox and change its orientation
            Document        doc     = new Document();
            DocumentBuilder builder = new DocumentBuilder(doc);

            Shape textbox = new Shape(doc, ShapeType.TextBox);

            textbox.Width  = 100;
            textbox.Height = 100;

            textbox.AppendChild(new Paragraph(doc));

            builder.InsertNode(textbox);

            builder.MoveTo(textbox.FirstParagraph);

            builder.Write("This text is flipped 90 degrees to the left.");

            textbox.TextBox.LayoutFlow = LayoutFlow.BottomToTop;
            doc.Save(MyDir + @"\Artifacts\Drawing.TextBox.docx");
            //ExEnd
        }