Package org.docx4j.wml

Examples of org.docx4j.wml.TblWidth


    this.setObject(val);
  }
 
  public AbstractCellMargin(CSSValue value, String suffix) { 
    CSSPrimitiveValue cssPrimitiveValue = (CSSPrimitiveValue)value;
    TblWidth tblWidth = Context.getWmlObjectFactory().createTblWidth();
    short ignored = 1;
    float fVal = cssPrimitiveValue.getFloatValue(ignored); // unit type ignored in cssparser

    int twip;
   
    short type = cssPrimitiveValue.getPrimitiveType();
    if (CSSPrimitiveValue.CSS_IN == type) {
      twip = UnitsOfMeasurement.inchToTwip(fVal);
    } else if (CSSPrimitiveValue.CSS_MM == type) {
      twip = UnitsOfMeasurement.mmToTwip(fVal);   
    } else if (CSSPrimitiveValue.CSS_PERCENTAGE == type) {
      twip = twipFromPercentage(fVal);   
    } else {
      log.error("No support for unit " + type);
      twip = 0;
    }
    init(suffix);
    tblWidth.setW(BigInteger.valueOf(twip));
    tblWidth.setType(TblWidth.TYPE_DXA);
    this.setObject(tblWidth);
  }
View Full Code Here


      foElement.setAttribute(foAttributeName, formatTwips(twips));       
    }
  }

  protected int getTwips() {
  TblWidth width = (TblWidth)getObject();
  int ret = -1;
    if ((width != null) && (width.getW() != null)) {
      ret = width.getW().intValue();
    }
    return ret;
  }
View Full Code Here

        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

 
  public Indent(CSSValue value) { 
   
    debug(CSS_NAME, value);
   
    TblWidth tblWidth = Context.getWmlObjectFactory().createTblWidth();
   
    CSSPrimitiveValue cssPrimitiveValue = (CSSPrimitiveValue)value; 
    short ignored = 1;
    float fVal = cssPrimitiveValue.getFloatValue(ignored); // unit type ignored in cssparser

    int twip;
   
    short type = cssPrimitiveValue.getPrimitiveType();
    if (CSSPrimitiveValue.CSS_IN == type) {
      twip = UnitsOfMeasurement.inchToTwip(fVal);
    } else if (CSSPrimitiveValue.CSS_MM == type) {
      twip = UnitsOfMeasurement.mmToTwip(fVal);   
    } else {
      log.error("No support for unit " + type);
      twip = 0;
    }
    tblWidth.setW(BigInteger.valueOf(twip) );   
    tblWidth.setType("dxa");   
    this.setObject(tblWidth);
   
  }
View Full Code Here

TOP

Related Classes of org.docx4j.wml.TblWidth

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.