Examples of XWPFParagraph


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

public class ApacheNewDocument
{
  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);
View Full Code Here

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

                // odd row
                  ctshd.setFill("EDF2F8");
              }

                // 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;
          rowCt++;
View Full Code Here

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

  {
    // Create a new document from scratch
        XWPFDocument doc = new XWPFDocument();
       
        // 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);
        out.close();
View Full Code Here

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

public class ApacheSaveDocument
{
  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
Copyright © 2018 www.massapi.com. 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.