Examples of CTShd


Examples of org.docx4j.wml.CTShd


  @Override
  public void setXslFO(Element foElement) {

    CTShd shd = ((CTShd)this.getObject());
   
    // TODO
    // STShd styleVal = shd.getVal(); 

    if (shd.getColor()!=null &&
        !shd.getColor().equals("auto")) {
      log.warn("TODO support w:shd/@w:color=" + shd.getColor() );
    }
   
    // We just support fill color right now
    if (shd.getFill()!=null &&
        !shd.getFill().equals("auto")) {
      foElement.setAttribute(FO_NAME, "#" + shd.getFill() );
    }
  }
View Full Code Here

Examples of org.docx4j.wml.CTShd

    this.setObject(shading);
  }
 
  public RShading(CSSValue value) { 

      CTShd shd = Context.getWmlObjectFactory().createCTShd();

      // PrimitiveType 25 -> RGBCOLOR
      short ignored = 1;

      float fRed;
      float fGreen;
      float fBlue;

      CSSPrimitiveValue cssPrimitiveValue = (CSSPrimitiveValue) value;
      try {
          fRed = cssPrimitiveValue.getRGBColorValue().getRed()
                  .getFloatValue(ignored);
          fGreen = cssPrimitiveValue.getRGBColorValue().getGreen()
                  .getFloatValue(ignored);
          fBlue = cssPrimitiveValue.getRGBColorValue().getBlue()
                  .getFloatValue(ignored);
        shd.setFill(UnitsOfMeasurement.rgbTripleToHex(fRed, fGreen, fBlue)  );
       
      } catch (UnsupportedOperationException e) {
       
        try {
          Class<?> xhtmlImporterClass = Class.forName("org.docx4j.convert.in.xhtml.FSColorToHexString");
            Method rgbToHexMethod = xhtmlImporterClass.getMethod("rgbToHex", CSSPrimitiveValue.class);
            shd.setFill((String)rgbToHexMethod.invoke(null, cssPrimitiveValue));
        } catch (Exception e2) {
            log.error("docx4j-XHTMLImport jar not found. Please add this to your classpath.");
        log.error(e2.getMessage(), e2);
        throw e; // same as before
     
View Full Code Here

Examples of org.docx4j.wml.CTShd

  }

  @Override
  public String getCssProperty() {
   
    CTShd shd = ((CTShd)this.getObject());
   
    // TODO
    // STShd styleVal = shd.getVal(); 

    if (shd.getColor()!=null &&
        !shd.getColor().equals("auto")) {
      log.warn("TODO support w:shd/@w:color=" + shd.getColor() );
    }
   
    // We just support fill color right now
    if (shd.getFill()!=null &&
        !shd.getFill().equals("auto")) {
      return composeCss(CSS_NAME, "#" + shd.getFill() );
    } else {
      return CSS_NULL;
    }
   
  }
View Full Code Here

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

     * 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

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

     */
    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

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

  public void testSetGetVertAlignment() throws Exception {
      // instantiate the following classes so they'll get picked up by
      // the XmlBean process and added to the jar file. they are required
      // for the following XWPFTableCell methods.
    CTShd ctShd = CTShd.Factory.newInstance();
    assertNotNull(ctShd);
    CTVerticalJc ctVjc = CTVerticalJc.Factory.newInstance();
    assertNotNull(ctVjc);
    STShd stShd = STShd.Factory.newInstance();
    assertNotNull(stShd);
View Full Code Here

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

     * 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

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

     */
    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

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

     * 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

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

     */
    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
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.