Example usage for org.apache.poi.xwpf.usermodel XWPFParagraph setAlignment

List of usage examples for org.apache.poi.xwpf.usermodel XWPFParagraph setAlignment

Introduction

In this page you can find the example usage for org.apache.poi.xwpf.usermodel XWPFParagraph setAlignment.

Prototype

public void setAlignment(ParagraphAlignment align) 

Source Link

Document

Specifies the paragraph alignment which shall be applied to text in this paragraph.

Usage

From source file:Utils.FileHandler.java

private void fullWidthPicture(XWPFDocument doc, File imgFile) throws InvalidFormatException, IOException {
    XWPFParagraph p2 = doc.createParagraph();
    p2.setAlignment(ParagraphAlignment.LEFT);
    XWPFRun imageRun = p2.createRun();/*from  w w  w  .  j  a v a2 s  .co m*/
    imageRun.setTextPosition(10);
    imageRun.setText("        ");
    imageRun.setFontSize(1);
    imageRun.addPicture(new FileInputStream(imgFile), XWPFDocument.PICTURE_TYPE_PNG, "image", Units.toEMU(469),
            Units.toEMU(274));
    p2.setBorderBottom(Borders.SINGLE);
    p2.setBorderTop(Borders.SINGLE);
    p2.setBorderRight(Borders.SINGLE);
    p2.setBorderLeft(Borders.SINGLE);

}