Package org.apache.poi.xwpf.usermodel

Examples of org.apache.poi.xwpf.usermodel.XWPFRun


    public void testIntegration() throws Exception {
        XWPFDocument doc = new XWPFDocument();

        XWPFParagraph p1 = doc.createParagraph();

        XWPFRun r1 = p1.createRun();
        r1.setText("Lorem ipsum dolor sit amet.");
        doc.enforceCommentsProtection();

        File tempFile = File.createTempFile("documentProtectionFile", ".docx");
        FileOutputStream out = new FileOutputStream(tempFile);
View Full Code Here


    public void testIntegration() throws Exception {
        XWPFDocument doc = new XWPFDocument();

        XWPFParagraph p1 = doc.createParagraph();

        XWPFRun r1 = p1.createRun();
        r1.setText("Lorem ipsum dolor sit amet.");
        doc.enforceCommentsProtection();

        File tempFile = TempFile.createTempFile("documentProtectionFile", ".docx");
        FileOutputStream out = new FileOutputStream(tempFile);
View Full Code Here

    public void testIntegration() throws Exception {
        XWPFDocument doc = new XWPFDocument();

        XWPFParagraph p1 = doc.createParagraph();

        XWPFRun r1 = p1.createRun();
        r1.setText("Lorem ipsum dolor sit amet.");
        doc.enforceCommentsProtection();

        File tempFile = TempFile.createTempFile("documentProtectionFile", ".docx");
        FileOutputStream out = new FileOutputStream(tempFile);
View Full Code Here

    public void testIntegration() throws Exception {
        XWPFDocument doc = new XWPFDocument();

        XWPFParagraph p1 = doc.createParagraph();

        XWPFRun r1 = p1.createRun();
        r1.setText("Lorem ipsum dolor sit amet.");
        doc.enforceCommentsProtection();

        File tempFile = TempFile.createTempFile("documentProtectionFile", ".docx");
        FileOutputStream out = new FileOutputStream(tempFile);
View Full Code Here

    public void testIntegration() throws Exception {
        XWPFDocument doc = new XWPFDocument();

        XWPFParagraph p1 = doc.createParagraph();

        XWPFRun r1 = p1.createRun();
        r1.setText("Lorem ipsum dolor sit amet.");
        doc.enforceCommentsProtection();

        File tempFile = TempFile.createTempFile("documentProtectionFile", ".docx");
        FileOutputStream out = new FileOutputStream(tempFile);
View Full Code Here

  {
    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
        r.addBreak(BreakType.PAGE);

      FileOutputStream out = new FileOutputStream("data/Apache_ImagesInDoc.docx");
      doc.write(out);
      out.close();
     
View Full Code Here

{
  public static void main(String[] args) throws Exception
  {
    XWPFDocument document = new XWPFDocument();
    XWPFParagraph tmpParagraph = document.createParagraph();
    XWPFRun tmpRun = tmpParagraph.createRun();
    tmpRun.setText("Apache Sample Content for Word file.");
    tmpRun.setFontSize(18);
   
    FileOutputStream fos = new FileOutputStream("data/Apache_newWordDoc.doc");
    document.write(fos);
    fos.close();
  }
View Full Code Here

              }

                // get 1st paragraph in cell's paragraph list
                XWPFParagraph para = cell.getParagraphs().get(0);
                // create a run to contain the content
                XWPFRun rh = para.createRun();
                // style cell as desired
                if (colCt == nCols - 1) {
                  // last column is 10pt Courier
                  rh.setFontSize(10);
                  rh.setFontFamily("Courier");
                }
                if (rowCt == 0) {
                  // header row
                    rh.setText("header row, col " + colCt);
                  rh.setBold(true);
                    para.setAlignment(ParagraphAlignment.CENTER);
                }
              else if (rowCt % 2 == 0) {
                // even row
                    rh.setText("row " + rowCt + ", col " + colCt);
                    para.setAlignment(ParagraphAlignment.LEFT);
              }
              else {
                // odd row
                    rh.setText("row " + rowCt + ", col " + colCt);
                    para.setAlignment(ParagraphAlignment.LEFT);
              }
                colCt++;
          } // for cell
          colCt = 0;
View Full Code Here

       
        // create paragraph
        XWPFParagraph para = doc.createParagraph();
       
        // create a run to contain the content
        XWPFRun rh = para.createRun();
       
        // Format as desired
      rh.setFontSize(15);
      rh.setFontFamily("Verdana");
        rh.setText("This is the formatted Text");
        rh.setColor("fff000");
        para.setAlignment(ParagraphAlignment.RIGHT);
       
        // write the file
        FileOutputStream out = new FileOutputStream("data/Apache_FormattedText.docx");
        doc.write(out);
View Full Code Here

  public static void main(String[] args) throws Exception
  {
    XWPFDocument document = new XWPFDocument();
    XWPFParagraph tmpParagraph = document.createParagraph();
   
    XWPFRun tmpRun = tmpParagraph.createRun();
    tmpRun.setText("Apache Sample Content for Word file.");
   
    FileOutputStream fos = new FileOutputStream("data/Apache_SaveDoc.doc");
    document.write(fos);
    fos.close();
   
View Full Code Here

TOP

Related Classes of org.apache.poi.xwpf.usermodel.XWPFRun

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.