Esempio n. 1
0
        public static void AddFloatingImage()
        {
            WordDocument        document = new WordDocument();
            WordDocumentBuilder builder  = new WordDocumentBuilder(document);

            builder.CharacterState.FontSize = 24;

            //Add floating image using builder
            using (Stream stream = File.OpenRead("sample.jpg"))
            {
                FloatingImage floatingImage1 = builder.InsertFloatingImage(stream, "jpg");
                floatingImage1.Wrapping.WrappingType = ShapeWrappingType.Square;
            }
            builder.InsertText("This text sentence content will display at the square of the floating image. ");
            builder.InsertText("This text sentence content will display at the square of the floating image.");

            WordFile wordFile = new WordFile();

            File.WriteAllBytes("AddFloatingImage.docx", wordFile.Export(document));
        }