Package org.openxmlformats.schemas.wordprocessingml.x2006.main

Examples of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTcPr


    /**
     * Set the vertical alignment of the cell.
     * @param vAlign - the desired alignment enum value
     */
    public void setVerticalAlignment(XWPFVertAlign vAlign) {
        CTTcPr tcpr = ctTc.isSetTcPr() ? ctTc.getTcPr() : ctTc.addNewTcPr();
      CTVerticalJc va = tcpr.addNewVAlign();
      va.setVal(alignMap.get(vAlign));
    }
View Full Code Here


     * Get the vertical alignment of the cell.
     * @return the cell alignment enum value
     */
    public XWPFVertAlign getVerticalAlignment() {
      XWPFVertAlign vAlign = null;
        CTTcPr tcpr = ctTc.getTcPr();
        if (ctTc != null) {
          CTVerticalJc va = tcpr.getVAlign();
          vAlign = stVertAlignTypeMap.get(va.getVal().intValue());
        }
        return vAlign;
    }
View Full Code Here

          // get the cells in this row
          List<XWPFTableCell> cells = row.getTableCells();
            // add content to each cell
          for (XWPFTableCell cell : cells) {
            // get a table cell properties element (tcPr)
            CTTcPr tcpr = cell.getCTTc().addNewTcPr();
            // set vertical alignment to "center"
            CTVerticalJc va = tcpr.addNewVAlign();
            va.setVal(STVerticalJc.CENTER);

            // create cell color element
            CTShd ctshd = tcpr.addNewShd();
                ctshd.setColor("auto");
                ctshd.setVal(STShd.CLEAR);
                if (rowCt == 0) {
                  // header row
                  ctshd.setFill("A7BFDE");
View Full Code Here

     * Set cell color. This sets some associated values; for finer control
     * you may want to access these elements individually.
     * @param rgbStr - the desired cell color, in the hex form "RRGGBB".
     */
    public void setColor(String rgbStr) {
        CTTcPr tcpr = ctTc.isSetTcPr() ? ctTc.getTcPr() : ctTc.addNewTcPr();
        CTShd ctshd = tcpr.isSetShd() ? tcpr.getShd() : tcpr.addNewShd();
        ctshd.setColor("auto");
        ctshd.setVal(STShd.CLEAR);
        ctshd.setFill(rgbStr);
    }
View Full Code Here

     * Get cell color. Note that this method only returns the "fill" value.
     * @return RGB string of cell color
     */
    public String getColor() {
  String color = null;
  CTTcPr tcpr = ctTc.getTcPr();
  if (tcpr != null) {
      CTShd ctshd = tcpr.getShd();
      if (ctshd != null) {
    color = ctshd.xgetFill().getStringValue();
      }
  }
  return color;
View Full Code Here

    /**
     * Set the vertical alignment of the cell.
     * @param vAlign - the desired alignment enum value
     */
    public void setVerticalAlignment(XWPFVertAlign vAlign) {
        CTTcPr tcpr = ctTc.isSetTcPr() ? ctTc.getTcPr() : ctTc.addNewTcPr();
      CTVerticalJc va = tcpr.addNewVAlign();
      va.setVal(alignMap.get(vAlign));
    }
View Full Code Here

     * Get the vertical alignment of the cell.
     * @return the cell alignment enum value
     */
    public XWPFVertAlign getVerticalAlignment() {
  XWPFVertAlign vAlign = null;
  CTTcPr tcpr = ctTc.getTcPr();
  if (ctTc != null) {
      CTVerticalJc va = tcpr.getVAlign();
      vAlign = stVertAlignTypeMap.get(va.getVal().intValue());
  }
  return vAlign;
    }
View Full Code Here

          // get the cells in this row
          List<XWPFTableCell> cells = row.getTableCells();
            // add content to each cell
          for (XWPFTableCell cell : cells) {
            // get a table cell properties element (tcPr)
            CTTcPr tcpr = cell.getCTTc().addNewTcPr();
            // set vertical alignment to "center"
            CTVerticalJc va = tcpr.addNewVAlign();
            va.setVal(STVerticalJc.CENTER);

            // create cell color element
            CTShd ctshd = tcpr.addNewShd();
                ctshd.setColor("auto");
                ctshd.setVal(STShd.CLEAR);
                if (rowCt == 0) {
                  // header row
                  ctshd.setFill("A7BFDE");
View Full Code Here

        CTTbl table = CTTbl.Factory.newInstance();
        CTRow row = table.addNewTr();
        CTTc cell = row.addNewTc();
        CTP paragraph = cell.addNewP();
        CTR run = paragraph.addNewR();
        CTText text = run.addNewT();
        text.setStringValue("finally I can write!");

        XWPFTable xtab = new XWPFTable(table, doc);
        assertEquals("finally I can write!\n", xtab.getText());
    }
View Full Code Here

        XWPFParagraph p = doc.createParagraph();

        CTP ctp = p.getCTP();
        CTPPr ppr = ctp.getPPr()== null? ctp.addNewPPr() : ctp.getPPr();

        CTTextAlignment txtAlign = ppr.addNewTextAlignment();
        txtAlign.setVal(STTextAlignment.CENTER);
        assertEquals(TextAlignment.CENTER, p.getVerticalAlignment());

        p.setVerticalAlignment(TextAlignment.BOTTOM);
        assertEquals(STTextAlignment.BOTTOM, ppr.getTextAlignment().getVal());
    }
View Full Code Here

TOP

Related Classes of org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTcPr

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.