Is it possible to replace a merge field with the contents of a datatable? (without having to add merge fields for all the fields in the datatable)




My suggestion is you build a query that returns one field with all your data fields appended and formatted in the way you want and then use only one mail merge field in the document to insert that data. Alternatively you can add a calculated column to the datatable to append all your table fields together before sending to mailmerge.


I want to turn my datatable into a table in the word document… The data is returned by a stored procedure and I don’t know what the field names are going to be (and they are irrelevant to the system)… Is there any way to do that?



Thanks, I see your point now.

At the moment this is not possible because Aspose.Word can dynamically grow document only in one direction - length. I mean it can repeat table rows or regions for every row in the table, but it cannot dynamically grow number of columns in a table.

But I don’t mind adding this feature as I see it could be useful. What do you want Aspose.Word to do about column widths, table formatting (borders etc), row with headings?

Maybe if you give me more details about the system you are trying to build I will come up with generic ideas for the new feature. What is the data, how the template is going to look like, where you are going to use it and so on.

If you don’t want to discuss these project details in the forums, just email to