We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Merge regions and header doc

We are evaluating Aspose.Word, mainly for MailMerge functionality. One of the requirements is to allow end user (with little knowledge of mailmerge) to modify the templates.
To ensure that they use the correct fields, I have created a Header document, which lists all the valid fields. They can then add this header doc to there file (Mail Merge Helper -> Data Source -> Get Data -> Header option)
This way they can just click and insert the needed field anywhere using the “Insert Merge Field” drop down. So far so good…
Now when I put TableStart:MyTable in the header file, word strips out the “:” and just inserts TableStartMyTable. Is there a work around for this? I guess there are two approaches:

  1. Make word not to strip the : (how?)
  2. Make Aspose use a different delimiter ("_" underscore) instead of “:” - again how?

Any ideas?

Did you try enclosing TableStart:MyTable in quotes? Try “TableStart:MyTable”

romank wrote:
Did you try enclosing TableStart:MyTable in quotes? Try “TableStart:MyTable”

Yes, tried quotes, square brackets, escaping : … no luck.
Another thought, is there a way for me to pre parse the Document loaded, replace all merge fields which have an under_score with a colon: and then run the mergewithactiveregions?

Ok, this happens because we never used header documents to select mail merge fields and there is no upfront info on what characters are allowed in MS Word field names. I think your idea to allow “_” to use as a separator in TableStart:MyTable is a good idea. I’ve added it to our task list, plan to implement in January.

Thanks, looking forward to it!
Please include Image:imageid also in the fix.

Using “_” as a separator for TableStart, TableEnd and Image is supported in Aspose.Word 3.5 that will be released 30th Jan.

Thanks, that’s a relief. Can you please update the documentation, because I spent several hours chasing the issue resulting from Word stripping out the colon from the data source field names.

Thanks for your remark. We will do this in the nearest future.
Best regards.