Package org.docx4j.wml

Examples of org.docx4j.wml.Tr


    org.docx4j.wml.ObjectFactory wmlObjectFactory = new org.docx4j.wml.ObjectFactory();

    Tbl tbl = wmlObjectFactory.createTbl();
    JAXBElement<org.docx4j.wml.Tbl> tblWrapped = wmlObjectFactory.createCTFtnEdnTbl(tbl);
        // Create object for tr
        Tr tr = wmlObjectFactory.createTr();
        tbl.getContent().add( tr);
            // Create object for tc (wrapped in JAXBElement)
            Tc tc = wmlObjectFactory.createTc();
            JAXBElement<org.docx4j.wml.Tc> tcWrapped = wmlObjectFactory.createTrTc(tc);
            tr.getContent().add( tcWrapped);    
   
    mdp.getContent().add(tbl);
   
    tc.getContent().add(createUnnumberedP());
   
View Full Code Here


  }
   
  private static void groupTable(Tbl table) {
   
    List<Object> cellElts = null;
    Tr tr = null;
    Tc tc = null;
    for (Object elemTr:table.getContent()) {
      if (elemTr instanceof JAXBElement) {
        elemTr = ((JAXBElement)elemTr).getValue();
      }
      if (elemTr instanceof Tr) {
        tr = (Tr)elemTr;
        if (tr.getContent() != null) {
          for (Object elemCe:tr.getContent()) {
            if (elemCe instanceof JAXBElement) {
              elemCe = ((JAXBElement)elemCe).getValue();
            }
            if (elemCe instanceof Tc) {
              tc = (Tc)elemCe;
View Full Code Here

      log.warn("Encountered table with no rows");
      return;
    }
   
    // Req 1: Make sure the last row is not a header row
    Tr lastRow = rows.get(numRows-1);
    if (isHeaderRow(lastRow)) {
      List<JAXBElement<?>> cnfStyleOrDivIdOrGridBefore = lastRow.getTrPr().getCnfStyleOrDivIdOrGridBefore();
      JAXBElement tblHeader = getElement(cnfStyleOrDivIdOrGridBefore, "tblHeader");
      cnfStyleOrDivIdOrGridBefore.remove(tblHeader);
    }
   
    // Req 2: All rows before last header row become header rows
    // .. find last header row
    int indexOfLastHeaderRow=-1;
    for (int i = rows.size(); i>0; i--) {
      Tr tr = rows.get(i-1);
      if (isHeaderRow(tr)) {
        indexOfLastHeaderRow = i-1;
        break;
      }
    }
    // .. now convert all rows up to that one
    for (int i = 0; i<indexOfLastHeaderRow; i++) {
      Tr tr = rows.get(i);
      if (!isHeaderRow(tr)) {
        // make it so...
        TrPr trpr = null;
        if (tr.getTrPr() == null) {
          trpr = Context.getWmlObjectFactory().createTrPr();
            tr.setTrPr(trpr);
        }
            // Create object for tblHeader (wrapped in JAXBElement)
            BooleanDefaultTrue booleandefaulttrue = Context.getWmlObjectFactory().createBooleanDefaultTrue();
            JAXBElement<org.docx4j.wml.BooleanDefaultTrue> booleandefaulttrueWrapped
              = Context.getWmlObjectFactory().createCTTrPrBaseTblHeader(booleandefaulttrue);
View Full Code Here

      tblGrid.getGridCol().add(gridCol);
    }
       
    // Now the rows
    for (int j=1 ; j<=rows; j++) {
      Tr tr = Context.getWmlObjectFactory().createTr();
      tbl.getEGContentRowContent().add(tr);
     
      // The cells
      for (int i=1 ; i<=cols; i++) {
       
        Tc tc = Context.getWmlObjectFactory().createTc();
        tr.getEGContentCellContent().add(tc);
       
        TcPr tcPr = Context.getWmlObjectFactory().createTcPr();
        tc.setTcPr(tcPr);
        // <w:tcW w:w="4788" w:type="dxa"/>
        TblWidth cellWidth = Context.getWmlObjectFactory().createTblWidth();
View Full Code Here

TOP

Related Classes of org.docx4j.wml.Tr

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.