Package org.docx4j.wml

Examples of org.docx4j.wml.Color


          log.warn(e.getMessage());
          date = new Date();

          // <w:color w:val="FF0000"/>
          rPr = factory.createRPr();
          Color colorRed = factory.createColor();
          colorRed.setVal("FF0000");
          rPr.setColor(colorRed);
        }
      }

      String result = formatter.format(date);
View Full Code Here


    float fRed;
    float fGreen;
    float fBlue;

    CSSPrimitiveValue cssPrimitiveValue = (CSSPrimitiveValue) value;
    Color color = Context.getWmlObjectFactory().createColor();
    try {
      fRed = cssPrimitiveValue.getRGBColorValue().getRed()
          .getFloatValue(ignored);
      fGreen = cssPrimitiveValue.getRGBColorValue().getGreen()
          .getFloatValue(ignored);
      fBlue = cssPrimitiveValue.getRGBColorValue().getBlue()
          .getFloatValue(ignored);
      color.setVal(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);
            color.setVal((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

TOP

Related Classes of org.docx4j.wml.Color

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.