Package org.docx4j.wml

Examples of org.docx4j.wml.CTSimpleField


   * @param fldSimpleModel
   * @param node
   */
  protected void applyStyle(AbstractWmlConversionContext context, FldSimpleModel fldSimpleModel, Node node) {
   
    CTSimpleField ctSimpleField = fldSimpleModel.getFldSimple();
    RPr rPr = null;
    if (node != null) {
      rPr = getRPr(ctSimpleField.getContent());
      if (rPr != null) {
        List<Property> properties = PropertyFactory.createProperties(context.getWmlPackage(), rPr);
        if ((properties != null) && (!properties.isEmpty())) {
          applyProperties(properties, node);
        }
View Full Code Here


      return (text != null ? text.getValue() : null);
    }


    private Object createFldSimple(String instrText, List<Object> resultList) {
    CTSimpleField fldSimple = Context.getWmlObjectFactory().createCTSimpleField();
      fldSimple.setInstr(instrText);
      if ((resultList != null) && (!resultList.isEmpty())) {
        fldSimple.getContent().addAll(resultList);
      }
      return fldSimple;
    }
View Full Code Here

           
  }
 
  private static CTSimpleField createSimpleField(String val) {
   
    CTSimpleField field = new CTSimpleField();
    field.setInstr(val);
      return field;
  }
View Full Code Here

    NumberExtractor nex = new NumberExtractor(".");   

    int i = 1;
    for (SwitchTestQuad tt : quads) {

      CTSimpleField simpleField = createSimpleField(tt, "myvar" +i, false);

      //System.out.println(XmlUtils.marshaltoString(simpleField, true, true));
      sb.append("\n\n" + simpleField.getInstr());

      FldSimpleModel fsm = new FldSimpleModel();
      try {
        fsm.build(simpleField.getInstr());
      } catch (TransformerException e) {
        e.printStackTrace();
      }

      try {
View Full Code Here

  private CTSimpleField createSimpleField(SwitchTestQuad triple, String varname, boolean useVarname) {

    ObjectFactory wmlObjectFactory = Context.getWmlObjectFactory();

    CTSimpleField field = wmlObjectFactory.createCTSimpleField();
    String instr = null;
    if (triple.format==null ) {
      if (useVarname && (instruction.equals("DOCPROPERTY ")
          || instruction.equals("MERGEFIELD "))) {
        instr = instruction + varname + " " + formattingSwitch;       
      } else {
        instr = instruction +triple.val + " " + formattingSwitch;
      }
    } else {
      if (useVarname && (instruction.equals("DOCPROPERTY ")
          || instruction.equals("MERGEFIELD "))) {
        if (triple.format.equals("")) {
          instr = instruction + varname  + " " + formattingSwitch;
        } else
        {
          instr = instruction + varname + " " + formattingSwitch + " " + triple.format;
        }
      } else {
        instr = instruction + triple.val + " " + formattingSwitch + " " + triple.format;
      }
    }

    field.setInstr(instr);

    R r = wmlObjectFactory.createR();
    Text t = wmlObjectFactory.createText();

    r.getContent().add(t);
    field.getContent().add(r);

    t.setValue("guess");

    return field;
  }
View Full Code Here

TOP

Related Classes of org.docx4j.wml.CTSimpleField

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.