Formatting Column Values Before Merge (Aspose.Words)


#1

Hi All,

My question is in reference to Aspose.Words components.

Is there a way to format my column values (dates and numeric values) before the data gets populated/merged into the document.

OR

Is there a way to populate/merge individual field values rather than passing the dataset/data table to populate the entire document.

Because I don't want my stored procedure to return the formatted values directly into my dataset/data table.

Thanks in advance

Narayanan Sankaranarayanan


#2

Hi Narayanan,

Thank you for your interest in Aspose.Words.

Answer for both questions is yes.

It is possible to do custom preprocessing of merged data using MergeField event.

See http://www.aspose.com/wiki/default.aspx/Aspose.Words/UsingMergeEvents.html for more info on this.

It is also possible to merge individual field values using MailMerge.Execute(String[], Object[]) method overload.

More on this in http://www.aspose.com/wiki/default.aspx/Aspose.Words/ExecutingMailMerge.html article.

Best Regards,


#3

Then how would this be for a repeating table?

I mean do you have a method with similar signature for ExecuteWithRegions.

Thanks

Narayanan Sankaranarayanan


#4

ExecuteWithRegions does not have such overload because data source for a table should have a 2D structure by definition. You can always create and fill DataTable manually in code if you want to customize data source.


#5

Would the MergeField event at least fire for repeating rows (ExecuteWithRegions)?

Thanks

Narayanan


#6

Yes, MergeField will fire for each merged data item when doing ExecuteWithRegions.