List of usage examples for org.apache.poi.xwpf.usermodel XWPFParagraph createRun
public XWPFRun createRun()
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(); imageRun.setTextPosition(10);//from ww w.java 2s . com 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); }
From source file:UtilsPackage.MakeRapport.java
private void createRapport(ObservableList<ModelNice> oNices) { if (document == null) return;// www .j a v a2 s. c om int numPage = 1; for (ModelNice model : oNices) { XWPFParagraph paragraph = document.createParagraph(); XWPFRun run = paragraph.createRun(); run.setFontSize(18); run.setText("Page: " + numPage); run.addBreak(); run.addBreak(); run.setText("Event Id: " + model.getEventId().toString()); run.addBreak(); run.setText("Event Type: " + model.getEventType()); run.addBreak(); run.setText("Categorie: " + model.getCategorie()); run.addBreak(); run.setText("Numro appelant: " + model.getNumCaller()); run.addBreak(); run.setText("Numro appel: " + model.getNumCalled()); run.addBreak(); run.addBreak(); run.setText("Synopsis:"); run.addBreak(); paragraph = document.createParagraph(); run = paragraph.createRun(); run.setFontSize(14); run.setText(model.getSynopsis()); run.addBreak(); paragraph = document.createParagraph(); run = paragraph.createRun(); run.setFontSize(18); run.setText("Content:"); run.addBreak(); paragraph = document.createParagraph(); run = paragraph.createRun(); run.setFontSize(14); run.setText(model.getSmsContent()); run.addBreak(BreakType.PAGE); // page +1 numPage++; } }