Renaming Mergefields


#1

Hi Roman,

As strange as this might sound…

We were wondering if Aspose.Word offers any functionality for renaming mergefields.

We are wanting to be able to open a template into memory, access a mergefield and have the functionality to rename the mergefield.

Our reasoning behind requesting this functionality is we are trying to make template creation as simple as possible for an end user.

In template creation we are wanting to link a HTML table to Word through the mailmerge wizard so a user can essentially drag and drop fields onto the template document.

This HTML table will be created based on the schema of an XML document resulting from a user defined query to a database.

We are wanting to display repeating data to the user through this HTML table as say “repeat_fieldname”, but we do not want to rename the actual fieldname in the database.

Therefore, once the template has been created using these ‘friendly fieldnames’, we would like the ability to rename them to their ‘actual’ fieldnames right before the merge with the data so we can match the fields with the data in the XML document.

I would be interested to hear your ideas on this.

Thanks,
Rich.


#2

Hi Rich,

This request is inline with our overall plans. I will make merge fields first class objects in the object model similar to MS Word and you will be able to insert and modify them. Estimated delivery August-September.


#3

Hi Rich,

I’ve found MS Word object model has MappedDataFields collection and I thought it would solve your problem nicely and easily for me.

I’ve released Aspose.Word 1.6.8 where MailMerge object has MappedDataFields collection. This is like a hashtable. The keys are the names of the merge fields in the document and the values are the names of the fields in your data source.

I’ve uploaded updated online documentation too.