Free Support Forum - aspose.com

Inserting a Field with bookmark

I am trying to insert a field using Aspose.words(Java)

VBA code is

intChars = ActiveDocument.Characters.Count
ActiveDocument.Characters(intChars - 1).Select
ActiveDocument.Fields.Add Selection.Range, wdFieldSet, "bm1 F2", false

I wrote the equivalent code as

Document doc = new Document(srcFile);

DocumentBuilder docBuild = new DocumentBuilder(doc);
docBuild.moveToDocumentEnd();
docBuild.insertField(" SET bm1 f2","hdrFieldDate");
doc.save(srcFile);

But the difference is that VBA code add a field with bookmark where as aspose.words(java) adds a field without the bookmark.

Please help me to solve this issue.

Also, what different values can be used as fieldCode in DocumentBuilder.insertField( , ) method.

Thanks in advance

Ok, I will to check this issue and let you know.

Best regards,