Adding a Run after a FieldSeparator (Java)

Hello - Do you have any examples of adding a ‘Run’ of text to a DocVariable field? In other words, I’ve seen that a Field in Aspose Words is typically defined as:
[FieldStart][Run (Field Code)][FieldSeparator][Run (Field Result/Value)][FieldEnd]

I am running into an issue where when I try to set the value of the DocVariable, there is no Run Node after the Field Separator. I am probably just unfamiliar with the API, but I can’t find a way to insert a new Run node after the FieldSeparator, but prior to the FieldEnd. We’ve got a large number of Word ‘Templates’ that are defined with
DocVariables. When a user goes to create a new document from the
‘Template’ (the template is not a .dot, just a regular .doc), we grab
the input fields, iterate through the document, and then set the
field’s value. This was previously performed with VB, but we are now
planning on using the Aspose Java API to do so. I can provide code samples and an example doc upon request.

Thanks in advance,
Kevin

Hi
Thank you for your interest in Aspose.Words. I don’t think that you need to insert Run after FieldSeparator. I think that you should just set value of DocVariable and update fields. See the following code:

// Open docuemnt
Document doc = new Document("in.doc");
// Set valuest of DocVariables
doc.getVariables().set("myDocVar", "This is new value of my variable");
// Update field in the document
doc.getRange().updateFields();
// Save output docuemnt
doc.save("out.doc");

Also please see the following link for more information.
https://reference.aspose.com/words/net/aspose.words/document/variables/
Hope this helps.
Best regards.

That appears to be working like a charm. Thanks so much for your speedy response!

Kevin