Package org.docx4j.wml

Examples of org.docx4j.wml.Tc


    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());
   
    tc.getContent().add(createNumberedP(1,0));
    tc.getContent().add(createNumberedP(1,0));

    tc.getContent().add(createUnnumberedP());

    ListsToContentControls.process(wordMLPackage);
   
    System.out.println(mdp.getXML());
   
View Full Code Here


        // where it needs to insert a tc, it has no way of adding original tcPr, so
        // we handle this here
    TcFinder tcFinder = new TcFinder();
    new TraversalUtil(((SdtElement)sdt).getSdtContent().getContent(), tcFinder);
    if (tcFinder.tcList.size()>0) {
      Tc tc = tcFinder.tcList.get(0);
      tc.getContent().clear();
      P p = Context.getWmlObjectFactory().createP();
      tc.getContent().add(p);     
          ((SdtElement)sdt).getSdtContent().getContent().clear();
          ((SdtElement)sdt).getSdtContent().getContent().add(tc);
    } else {
          ((SdtElement)sdt).getSdtContent().getContent().clear();
    }
View Full Code Here

        // where it needs to insert a tc, it has no way of adding original tcPr, so
        // we handle this here
    TcFinder tcFinder = new TcFinder();
    new TraversalUtil(((SdtElement)sdt).getSdtContent().getContent(), tcFinder);
    if (tcFinder.tcList.size()>0) {
      Tc tc = tcFinder.tcList.get(0);
      tc.getContent().clear();
      P p = Context.getWmlObjectFactory().createP();
      tc.getContent().add(p);
          ((SdtElement)sdt).getSdtContent().getContent().clear();
          ((SdtElement)sdt).getSdtContent().getContent().add(tc);
    } else {
          ((SdtElement)sdt).getSdtContent().getContent().clear();
    }
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;
              if (tc.getContent() != null) {
                cellElts = groupBodyContent(tc.getContent());
                if (cellElts != null) {
                  tc.getContent().clear();
                  tc.getContent().addAll(cellElts);
                }
              }
            }
          }
        }
View Full Code Here

      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();
        tcPr.setTcW(cellWidth);
        cellWidth.setType("dxa");
        cellWidth.setW(BigInteger.valueOf(cellWidthTwips));
       
        // Cell content - an empty <w:p/>
        tc.getEGBlockLevelElts().add(
            Context.getWmlObjectFactory().createP()
            );
      }
     
    }
View Full Code Here

TOP

Related Classes of org.docx4j.wml.Tc

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.