VariableField variableField=Fields.createUserVariableField(document, fieldname,value);
nextFieldSelection.replaceWithVariableField(variableField);
newfield=variableField;
break;
case CONDITION_FIELD:
ConditionField conditionField = (ConditionField)orgField;
TextConditionalTextElement textConditionalTextElement =(TextConditionalTextElement) conditionField.getOdfElement();
String StringValueIfFalse=textConditionalTextElement.getTextStringValueIfFalseAttribute();
String StringValueIfTrue=textConditionalTextElement.getTextStringValueIfTrueAttribute();
String StringCondition=textConditionalTextElement.getTextConditionAttribute();
boolean CurrentValue=textConditionalTextElement.getTextCurrentValueAttribute();
ConditionField newdConditionField = nextFieldSelection.replaceWithConditionField(StringCondition, StringValueIfTrue, StringValueIfFalse);
TextConditionalTextElement newTextConditionalTextElement=(TextConditionalTextElement)newdConditionField.getOdfElement();
newTextConditionalTextElement.setTextCurrentValueAttribute(CurrentValue);
newfield=newdConditionField;
break;
case HIDDEN_TEXT_FIELD:
ConditionField conditionFieldHIDDEN = (ConditionField)orgField;
TextConditionalTextElement textConditionalTextElementHIDDEN =(TextConditionalTextElement) conditionFieldHIDDEN.getOdfElement();
String StringValueIfFalseHIDDEN=textConditionalTextElementHIDDEN.getTextStringValueIfFalseAttribute();
String StringConditionHIDDEN=textConditionalTextElementHIDDEN.getTextConditionAttribute();
boolean CurrentValueHIDDEN=textConditionalTextElementHIDDEN.getTextCurrentValueAttribute();
ConditionField newdConditionFieldHIDDEN = nextFieldSelection.replaceWithHiddenTextField(StringConditionHIDDEN, StringValueIfFalseHIDDEN);
TextConditionalTextElement newTextConditionalTextElementHIDDEN=(TextConditionalTextElement)newdConditionFieldHIDDEN.getOdfElement();
newTextConditionalTextElementHIDDEN.setTextCurrentValueAttribute(CurrentValueHIDDEN);
newfield=newdConditionFieldHIDDEN;
break;
case REFERENCE_FIELD:
default: throw new IllegalArgumentException("Simple Java API for ODF doesn't support this type now.");