Package org.apache.poi.xwpf.usermodel

Examples of org.apache.poi.xwpf.usermodel.XWPFDocument.createTable()


        //XWPFDocument doc = new XWPFDocument(new FileInputStream("base_document.docx"));

      // Create a new table with 6 rows and 3 columns
      int nRows = 6;
      int nCols = 3;
        XWPFTable table = doc.createTable(nRows, nCols);

        // Set the table style. If the style is not defined, the table style
        // will become "Normal".
        CTTblPr tblPr = table.getCTTbl().getTblPr();
        CTString styleStr = tblPr.addNewTblStyle();
View Full Code Here


  public static void main(String[] args) throws Exception
  {
    XWPFDocument document = new XWPFDocument();
   
    // New 2x2 table
    XWPFTable tableOne = document.createTable();
    XWPFTableRow tableOneRowOne = tableOne.getRow(0);
    tableOneRowOne.getCell(0).setText("Hello");
    tableOneRowOne.addNewTableCell().setText("World");
   
    XWPFTableRow tableOneRowTwo = tableOne.createRow();
View Full Code Here

   
    // Add a break between the tables
    document.createParagraph().createRun().addBreak();
   
    // New 3x3 table
    XWPFTable tableTwo = document.createTable();
    XWPFTableRow tableTwoRowOne = tableTwo.getRow(0);
    tableTwoRowOne.getCell(0).setText("col one, row one");
    tableTwoRowOne.addNewTableCell().setText("col two, row one");
    tableTwoRowOne.addNewTableCell().setText("col three, row one");
   
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.