Merge field capability with Aspose Words

Hi,
I am trying to insert fields into new/existing documents using Aspose Editor. Editor currently does not have the functionality to do this. The post below says “But you may accomplish this, except Microsoft Word macros, using Aspose.Words and then load WordML stream into the editor.”
Can you explain what this means? And also help me understand how to create(insert) a merge field(s) using Aspose Words.
thanks,
archana

Hi
Thanks for your inquiry. This means that you can insert bookmark or mergefield using Aspose.Words and then load the updated document into Aspose.Editor.
You can insert bookmark into the document using InsertBookmark method. See the following link to learn more:
https://docs.aspose.com/words/net/working-with-bookmarks/
You can insert mergefield using InsertField method:
https://docs.aspose.com/words/java/working-with-fields/
Hope this helps.
Best regards.

Hi,
How can you load a document of type Aspose.Words.Document in to Aspose.Editor which expects a document of type Aspose.Editor.Desktop.Document?
Can you please provide me with a VB sample of the following:
“insert mergefield using Aspose.Words and then load the updated document into Aspose.Editor.”
thanks,
archana

Hi
Thanks for your inquiry. Here is VB code that you can use:

'Open existing document using Aspose.Words
Dim doc As Aspose.Words.Document = New Aspose.Words.Document("C:\Temp\in.doc")
'Create DocumentBuilder
Dim builder As Aspose.Words.DocumentBuilder = New Aspose.Words.DocumentBuilder(doc)
'Move cursor to the end of document
'You also can move cursor to any place in the document using MoveToXXX method
builder.MoveToDocumentEnd()
'Insert mergefield into the document
builder.InsertField("MERGEFIELD MyFieldName \* MERGEFORMAT", "«MyFieldName»")
'Save the document into the stream
Dim awDocStream As New System.IO.MemoryStream()
doc.Save(awDocStream, Aspose.Words.SaveFormat.WordML)
'Set current position of Stream 0 (begining of stream) 
awDocStream.Seek(0, IO.SeekOrigin.Begin)
'Load document into the Editor control
EditorControl1.Open(awDocStream)

But note that Aspose.Editor shows fields as red crosses. Red crosses are the marks for unknown (for current version) document items. You can read about this here: https://products.groupdocs.com/editor/
Current version of Aspose.Editor treats images and fields as unknown items.
Best regards.