UseNonMergeFields- INCLUDETEXT- footer/header

Hello
I’ve several word documents that use the same footer. I want to put the footer part in a single document and then merge the generic footer in my doc.
This is the perfect field type for me : << INCLUDETEXT <>
And… that work fine for me… I know that some users complains about that in forum, but for me is good! I just need to made replace("","\") to the filepath before merge it. So, my problem is that is not working in the FOOTER AREA !!!
I read a couple of forum threads about that subjet but nothing about this specific problem. Can you help me with this?
It seems that the property UseNonMergeFields = true, don’t have effect on the footer/header area. What you think?
Thanks
Nick

Hi
Thanks for your inquiry. If you need to do replacement during mail merge then you should use MergeField event handler. For example see the following code:

public void Test252()
{
    string[] names = { "mytext" };
    string[] values = { @"C:\Temp\my.txt" };
    Document doc = new Document(@"Test252\in.doc");
    doc.MailMerge.MergeField += new MergeFieldEventHandler(MailMerge_MergeField252);
    doc.MailMerge.Execute(names, values);
    doc.Save(@"Test252\out.doc");
}
void MailMerge_MergeField252(object sender, MergeFieldEventArgs e)
{
    if (e.FieldName == "mytext")
    {
        e.Text = e.FieldValue.ToString().Replace(@"\", @"\\");
    }
}

Hope this helps.
In this case you don’t need to use UseNonMergeFields. See the following link for more information.
https://reference.aspose.com/words/net/aspose.words.mailmerging/mailmerge/usenonmergefields/
Best regards.

Is not what i’m looking for…
I want to use the INCLUDETEXT in the footer area…
I can use the INCLUDETEXT in document but NOT in the footer area!
I think that the UseNonMergeFields do not work in the footer/header area.
If I put the same !! INCLUDETEXT !!MERGEFIELD!! !! in the footer and the core… The field in the core will work and the field in the footer will NOT work.
I don’t get the same result in the footer area that i get in the main area.
thanks
Nick

Hi
Sorry. I forgot to attach my documents. Please check the attached documents and let me know if this doesn’t work for you.
Also please attach your document for testing.
Best regards.

I found one solution.

For Each aStory As Microsoft.Office.Interop.Word.Range In _WordApplication.ActiveDocument.StoryRanges
aStory.Fields.Update()
Next aStory

I need to open a the document with word interop and update all fields in ALL RANGES. That work for me.
Thanks
Nick

Hi
It is nice that you found solution.
Best regards.