-
Notifications
You must be signed in to change notification settings - Fork 5
Insert Image
shoaibkhan-aspose edited this page Sep 23, 2014
·
1 revision
XWPFDocument doc = new XWPFDocument();
XWPFParagraph p = doc.createParagraph();
String imgFile = "aspose.jpg";
XWPFRun r = p.createRun();
int format = XWPFDocument.PICTURE_TYPE_JPEG;
r.setText(imgFile);
r.addBreak();
r.addPicture(new FileInputStream(imgFile), format, imgFile, Units.toEMU(200), Units.toEMU(200)); // 200x200 pixels
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.insertImage("data/background.jpg");
builder.insertImage("data/background.jpg",
RelativeHorizontalPosition.MARGIN,
100,
RelativeVerticalPosition.MARGIN,
200,
200,
100,
WrapType.SQUARE);
Download Source Code
Many more examples are available at Aspose Docs
For further releases and updates, please follow these new repositories:
- Aspose.Words Java for Apache POI
- Aspose.Cells Java for Apache POI
- Aspose.Slides Java for Apache POI
- Aspose.Email Java for Apache POI
- For documentation, please visit Aspose Docs.
- Raise your queries and suggest more examples via Aspose Forums or via new social coding sites.