Merging with Microsoft Word

Hi All,

I need to add some Merge fileds in Header/Footer level of a word Document. and how could i update them using coding in Navision ?

help me regarding this.

Thank you .


You will need to modify codeunit 5054 WordManagement and add in the fields with calls to the Addfield function in the CreateHeader and ExecuteMerge functions.


actually i am not using Codeunit 5054 WordManagement.

i have just create a Template and i am going to write it using MergeFields.

using WordDoc Automation.

TemplateName := ‘C:\’;
WdDoc := Wdapp.Documents.Add(TemplateName);
//Wdapp.ActiveWindow.View.SeekView := 9;
WdRange := Wdapp.ActiveDocument.Fields.Item(1).Result;
WdRange.Text := Customer.“No.”;
WdRange.Bold := 1;
WdRange := Wdapp.ActiveDocument.Fields.Item(2).Result;
WdRange.Text := Customer.Name;
WdRange.Bold := 1;
WdRange := Wdapp.ActiveDocument.Fields.Item(3).Result;
WdRange.Text := Customer.Address;
WdRange.Bold := 1;
Wdapp.Visible := TRUE;

using this code i can abe to add fields and update them at Body Level.

similarly i need to add some Fields at Header level and need to update.

which collection do i need to use for my requirement?

Hello, any solution please…

What’s your reason for doing it this way and not use the standard functionality?

I don’t have idea how to use that codeunit.

please guide me …

thank you for your suppor.

Hi Danda,

Have a look at the standard create interaction - form 5077 - it should give you a good example of how to use the codeunit.