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;
}