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