Monday, 29 July 2019 08:22

How to wrap text around image on Word document in Java

Written by  support iceblue
Rate this item
(0 votes)

This article will show you how to set the wrapping style to adjust the position of the image in Java applications with the help of Spire.Doc for Java.

import com.spire.doc.*;
import com.spire.doc.documents.Paragraph;
import com.spire.doc.documents.TextWrappingStyle;
import com.spire.doc.documents.TextWrappingType;
import com.spire.doc.fields.DocPicture;

public class ImageWrappingStyle {
    public static void main(String[] args) throws Exception {

        Document doc = new Document();

        Section sec = doc.getSections().get(0);

        Paragraph para = sec.getParagraphs().get(0);
        DocPicture picture = para.appendPicture("logo.png");

        //Set image width and height

        //Set text wrapping style to Behind

        //Save the document to file


Effective screenshot after setting the wrapping style for image:

How to wrap text around image on Word document in Java

Additional Info

  • tutorial_title: Wrap text around image on Word document in Java
Last modified on Monday, 29 July 2019 08:29