Package org.docx4j.wml

Examples of org.docx4j.wml.CTBorder


  @Override
  public String getCssProperty() {
   
    // <w:left w:val="single" w:sz="4"
    //         w:space="0" w:color="000000" w:themeColor="text1"/>
    CTBorder border = (CTBorder)getObject();
   
    if (border==null) return "";
   
    String val = "";
    if (border.getVal()!=null) {
      STBorder stBorder = border.getVal();
     
      log.debug("border: " + stBorder);
     
      if (stBorder.equals(STBorder.NIL)
          || stBorder == STBorder.NONE) {
        val = composeCss(CSS_NAME__STYLE, "none");
      } else if (stBorder==STBorder.SINGLE) {
        // can use == or .equals
        val = composeCss(CSS_NAME__STYLE, "solid");       
      } else if (stBorder == STBorder.DOUBLE
          || stBorder == STBorder.DOTTED
          || stBorder == STBorder.DASHED
          || stBorder == STBorder.OUTSET
          || stBorder == STBorder.INSET) {
        val = composeCss(CSS_NAME__STYLE, stBorder.value() );       
      } else {
        // fallback
        log.warn("Falling back to solid");
        val = composeCss(CSS_NAME__STYLE, "solid");
      }
    }

    String sz = "";
    if (border.getSz()!=null) {
      float mm = eighthsToMM(border.getSz().intValue()); // eights of a point
      if (mm<0.262) {
        // At 96dpi, that's 1 pixel. Anything less WebKit won't display
        sz = composeCss(CSS_NAME__WIDTH, "1px" );
      } else {
        sz = composeCss(CSS_NAME__WIDTH,
            UnitsOfMeasurement.format2DP.format(mm) + "mm" );
      }
    }
   
    String color = "";
    // IE8 needs color to be specified.  Other browsers don't care.
    if (border.getColor()!=null) {
      if (border.getColor().equals("auto")) {
        color = composeCss(CSS_NAME__COLOR, "#000000"  );
      } else {
        color = composeCss(CSS_NAME__COLOR, "#" + border.getColor() );
      }
    }
   
    return val + sz + color;
  }
View Full Code Here


   

  @Override
  public void setXslFO(Element foElement) {
   
    CTBorder border = (CTBorder)getObject();
   
    if (border==null) return;
   
    if (border.getVal()!=null) {
      STBorder stBorder = border.getVal();
     
      log.debug("border: " + stBorder);
     
      if (stBorder.equals(STBorder.NIL)
          || stBorder == STBorder.NONE) {
        foElement.setAttribute(CSS_NAME__STYLE, "none");
      } else if (stBorder==STBorder.SINGLE) {
        // can use == or .equals
        foElement.setAttribute(CSS_NAME__STYLE, "solid");       
      } else if (stBorder == STBorder.DOUBLE
          || stBorder == STBorder.DOTTED
          || stBorder == STBorder.DASHED
          || stBorder == STBorder.OUTSET
          || stBorder == STBorder.INSET) {
        foElement.setAttribute(CSS_NAME__STYLE, stBorder.value() );       
      } else {
        // fallback
        log.warn("Falling back to solid");
        foElement.setAttribute(CSS_NAME__STYLE, "solid");
      }
    }

    if (border.getSz()!=null) {
       // eights of a point
      float mm = eighthsToMM(border.getSz().intValue()); // eights of a point
      foElement.setAttribute(CSS_NAME__WIDTH,
          UnitsOfMeasurement.format2DP.format(mm) + "mm" );
    }

    if (border.getColor()!=null) {
      if (border.getColor().equals("auto")) {
        foElement.setAttribute(CSS_NAME__COLOR, "#000000"  );
      } else {
        foElement.setAttribute(CSS_NAME__COLOR, "#" + border.getColor() );
      }
    }
   
  }
View Full Code Here

    applyTableCustomAttributes(context, table, transformState, tableRoot);
  }

  protected void appendNoneBordersAndShading(List<Property> tableProperties) {
  CTBorder ctBrdr = null;
  CTShd shd = Context.getWmlObjectFactory().createCTShd();
    ctBrdr = Context.getWmlObjectFactory().createCTBorder();
    ctBrdr.setVal(STBorder.NONE);
    tableProperties.add(new BorderLeft(ctBrdr));
    ctBrdr = Context.getWmlObjectFactory().createCTBorder();
    ctBrdr.setVal(STBorder.NONE);
    tableProperties.add(new BorderRight(ctBrdr));
    ctBrdr = Context.getWmlObjectFactory().createCTBorder();
    ctBrdr.setVal(STBorder.NONE);
    tableProperties.add(new BorderTop(ctBrdr));
    ctBrdr = Context.getWmlObjectFactory().createCTBorder();
    ctBrdr.setVal(STBorder.NONE);
    tableProperties.add(new BorderBottom(ctBrdr));
    shd.setColor("auto");
    shd.setFill("auto");
    shd.setVal(STShd.CLEAR);
    tableProperties.add(new Shading(shd));
View Full Code Here

 
  private static List<Object> groupRuns(List<Object> paragraphElts) {
   
    List<Object> resultElts = new ArrayList<Object>();
    SdtBlock currentBlock = null;
    CTBorder lastBorder = null;
    CTBorder currentBorder = null;
    R run = null;
   
//      java.util.Stack stack = new java.util.Stack();
//      stack.push(newList);
   
View Full Code Here

  @Override
  public String getCssProperty() {
   
    // <w:left w:val="single" w:sz="4"
    //         w:space="0" w:color="000000" w:themeColor="text1"/>
    CTBorder border = (CTBorder)getObject();
   
    if (border==null) return "";
   
    String val = "";
    if (border.getVal()!=null) {
      STBorder stBorder = border.getVal();
     
      log.debug("border: " + stBorder);
     
      if (stBorder.equals(STBorder.NIL)
          || stBorder == STBorder.NONE) {
        val = composeCss(CSS_NAME__STYLE, "none");
      } else if (stBorder==STBorder.SINGLE) {
        // can use == or .equals
        val = composeCss(CSS_NAME__STYLE, "solid");       
      } else if (stBorder == STBorder.DOUBLE
          || stBorder == STBorder.DOTTED
          || stBorder == STBorder.DASHED
          || stBorder == STBorder.OUTSET
          || stBorder == STBorder.INSET) {
        val = composeCss(CSS_NAME__STYLE, stBorder.value() );       
      } else {
        // fallback
        log.warn("Falling back to solid");
        val = composeCss(CSS_NAME__STYLE, "solid");
      }
    }

    String sz = "";
    if (border.getSz()!=null) {
      float mm = eighthsToMM(border.getSz().intValue()); // eights of a point
      if (mm<0.262) {
        // At 96dpi, that's 1 pixel. Anything less WebKit won't display
        sz = composeCss(CSS_NAME__WIDTH, "1px" );
      } else {
        sz = composeCss(CSS_NAME__WIDTH,
            UnitsOfMeasurement.format2DP.format(mm) + "mm" );
      }
    }
   
    String color = "";
    // IE8 needs color to be specified.  Other browsers don't care.
    if (border.getColor()!=null) {
      if (border.getColor().equals("auto")) {
        color = composeCss(CSS_NAME__COLOR, "#000000"  );
      } else {
        color = composeCss(CSS_NAME__COLOR, "#" + border.getColor() );
      }
    }
   
    return val + sz + color;
  }
View Full Code Here

   

  @Override
  public void setXslFO(Element foElement) {
   
    CTBorder border = (CTBorder)getObject();
   
    if (border==null) return;
   
    if (border.getVal()!=null) {
      STBorder stBorder = border.getVal();
     
      log.debug("border: " + stBorder);
     
      if (stBorder.equals(STBorder.NIL)
          || stBorder == STBorder.NONE) {
        foElement.setAttribute(CSS_NAME__STYLE, "none");
      } else if (stBorder==STBorder.SINGLE) {
        // can use == or .equals
        foElement.setAttribute(CSS_NAME__STYLE, "solid");       
      } else if (stBorder == STBorder.DOUBLE
          || stBorder == STBorder.DOTTED
          || stBorder == STBorder.DASHED
          || stBorder == STBorder.OUTSET
          || stBorder == STBorder.INSET) {
        foElement.setAttribute(CSS_NAME__STYLE, stBorder.value() );       
      } else {
        // fallback
        log.warn("Falling back to solid");
        foElement.setAttribute(CSS_NAME__STYLE, "solid");
      }
    }

    if (border.getSz()!=null) {
       // eights of a point
      float pt = border.getSz().intValue() / 8f; // eights of a point
      foElement.setAttribute(CSS_NAME__WIDTH,
          UnitsOfMeasurement.format2DP.format(pt) + "pt" );
    }

    if (border.getColor()!=null) {
      if (border.getColor().equals("auto")) {
        foElement.setAttribute(CSS_NAME__COLOR, "#000000"  );
      } else {
        foElement.setAttribute(CSS_NAME__COLOR, "#" + border.getColor() );
      }
    }
   
  }
View Full Code Here

  @Override
  public String getCssProperty() {
   
    // <w:left w:val="single" w:sz="4"
    //         w:space="0" w:color="000000" w:themeColor="text1"/>
    CTBorder border = (CTBorder)getObject();
   
    if (border==null) return "";
   
    String val = "";
    if (border.getVal()!=null) {
      STBorder stBorder = border.getVal();
     
      log.debug("border: " + stBorder);
     
      if (stBorder.equals(STBorder.NIL)
          || stBorder == STBorder.NONE) {
        val = "none";
      } else if (stBorder==STBorder.SINGLE) {
        // can use == or .equals
        val = "solid";       
      } else if (stBorder == STBorder.DOUBLE
          || stBorder == STBorder.DOTTED
          || stBorder == STBorder.DASHED
          || stBorder == STBorder.OUTSET
          || stBorder == STBorder.INSET) {
        val = stBorder.value();       
      } else {
        // fallback
        log.warn("Falling back to solid");
        val = "solid";
      }
      val = composeCss(CSS_NAME_STYLE, val);
    }

    String sz = "";
    if (border.getSz()!=null) {
      float mm = eighthsToMM(border.getSz().intValue()); // eights of a point
      if (mm<0.262) {
        // At 96dpi, that's 1 pixel. Anything less WebKit won't display
        sz = "1px";
      } else {
        sz = UnitsOfMeasurement.format2DP.format(mm) + "mm" ;
      }
      sz = composeCss(CSS_NAME_WIDTH, sz);
    }
   
    String color = "";
    // IE8 needs color to be specified.  Other browsers don't care.
    if (border.getColor()!=null) {
      if (border.getColor().equals("auto")) {
        color = "#000000";
      } else {
        color = "#" + border.getColor();
      }
      color = composeCss(CSS_NAME_COLOR, color);
    }
   
    return val + sz + color;
View Full Code Here

  @Override
  public void setXslFO(Element foElement) {
  String val = null;
   
    CTBorder border = (CTBorder)getObject();
   
    if (border==null) return;
   
    if (border.getVal()!=null) {
      STBorder stBorder = border.getVal();
     
      log.debug("border: " + stBorder);
     
      if (stBorder.equals(STBorder.NIL)
          || stBorder == STBorder.NONE) {
        val = "none";
      } else if (stBorder==STBorder.SINGLE) {
        // can use == or .equals
        val = "solid";       
      } else if (stBorder == STBorder.DOUBLE
          || stBorder == STBorder.DOTTED
          || stBorder == STBorder.DASHED
          || stBorder == STBorder.OUTSET
          || stBorder == STBorder.INSET) {
        val = stBorder.value();       
      } else {
        // fallback
        log.warn("Falling back to solid");
        val = "solid";
      }
      foElement.setAttribute(CSS_NAME_STYLE, val);
    }

    if (border.getSz()!=null) {
       // eights of a point
      float mm = eighthsToMM(border.getSz().intValue()); // eights of a point
      val = UnitsOfMeasurement.format2DP.format(mm) + "mm";
      foElement.setAttribute(CSS_NAME_WIDTH, val);
    }

    if (border.getColor()!=null) {
      if (border.getColor().equals("auto")) {
        val = "#000000";
      } else {
        val = "#" + border.getColor();
      }
      foElement.setAttribute(CSS_NAME_COLOR, val);
    }
   
  }
View Full Code Here

TOP

Related Classes of org.docx4j.wml.CTBorder

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.