Problem with DocumentBuilder.MoveToMergeField Method


#1

Problem with DocumentBuilder.MoveToMergeField Method

Aspose.Words API Reference:

Return Value:True if the merge field was found; false otherwise.

but this method always return false, even through merge field was found.


#2

MoveToMergeField works correctly in our internal tests. Please send us the problem document and the code snippet sufficient to reproduce the error.


#3

I've checked it one more time and found the problem.

This is part of the source code works:

bool res = builder.MoveToMergeField("MyHeader");

But if i wrote this way:

MessageBox.Show(builder.MoveToMergeField("MyHeader").ToString())

it will not work.


#4

Please mind, that MoveToMergeField method actually deletes the merge field it finds. So, if you call it two times in a row it will first return true, then false.