Пример #1
0
        public void CreateIllustrationUsingTheFrameBuilder()
        {
            TextDocument document = new TextDocument();

            document.New();
            //Create a standard pargraph for the illustration
            Paragraph paragraphStandard = ParagraphBuilder.CreateStandardTextParagraph(document);
            //Create Illustration Frame using the FrameBuilder
            Frame frameIllustration = FrameBuilder.BuildIllustrationFrame(
                document,
                "illustration_frame_1",
                "graphic1",
                new DiskFile(_imagefile),
                "This is a Illustration",
                1);

            //Add the Illustration Frame to the Paragraph
            paragraphStandard.Content.Add(frameIllustration);
            Assert.IsTrue(frameIllustration.Content[0] is DrawTextBox, "Must be a DrawTextBox!");
            Assert.IsTrue(((DrawTextBox)frameIllustration.Content[0]).Content[0] is Paragraph, "Must be a Paragraph!");
            Paragraph paragraph = ((DrawTextBox)frameIllustration.Content[0]).Content[0] as Paragraph;

            Assert.IsTrue(paragraph.TextContent[1] is TextSequence, "Must be a TextSequence!");
            //Add Paragraph to the document
            document.Content.Add(paragraphStandard);
            //Save the document
            using (IPackageWriter writer = new OnDiskPackageWriter())
            {
                document.Save(AARunMeFirstAndOnce.outPutFolder + "illustration.odt", new OpenDocumentTextExporter(writer));
            }
        }