Package org.odftoolkit.odfdom.dom.element.text

Examples of org.odftoolkit.odfdom.dom.element.text.TextVariableSetElement


   */
  public void updateField(String value, OdfElement refElement) {
    String officeNS = OdfDocumentNamespace.OFFICE.getUri();
    switch (type) {
    case SIMPLE:
      TextVariableSetElement textVariableSetElement = null;
      if (refElement instanceof TextPElement) {
        textVariableSetElement = ((TextPElement) refElement).newTextVariableSetElement(0, "string", name);
      } else if (refElement instanceof TextSpanElement) {
        textVariableSetElement = ((TextSpanElement) refElement).newTextVariableSetElement(0, "string", name);
      } else {
        TextPElement pElement = ((OdfFileDom) refElement.getOwnerDocument()).newOdfElement(TextPElement.class);
        OdfElement parentEle = (OdfElement) refElement.getParentNode();
        parentEle.insertBefore(pElement, refElement.getNextSibling());
        textVariableSetElement = pElement.newTextVariableSetElement(0, "string", name);
      }
      textVariableSetElement.removeAttributeNS(officeNS, "value");
      textVariableSetElement.setOfficeStringValueAttribute(value);
      textVariableSetElement.setTextContent(value);
      break;
    case USER:
      userVariableElement.setOfficeValueTypeAttribute("string");
      userVariableElement.setOfficeStringValueAttribute(value);
      break;
View Full Code Here

TOP

Related Classes of org.odftoolkit.odfdom.dom.element.text.TextVariableSetElement

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.