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

Free Support Forum - aspose.com

Events in ReportingEngine

We are heavy users of Aspose.Words but so far we didn´t used the ReportingEngine Mechanism of your product. We realized that for certain cases we cannot do the same things we used to do with MailMerge with regions. For example using MergeFieldEvents we could render our values acordding to a custom logic associated with the type of that object with no dependecies of the Word document in use. For Instance, a value for a MergeField could be an:

  • ImageType. Renders an Image on the fly with borders (or not) and some other options that come as properties of this value.
  • TickType. Renders a list of labeled checkboxes with one of them selected and tiled in horizontal or vertical fashion, sometimes in bilingual or some language diferent than the OS´s.
  • CustomDateTimeType. Renders a date as an Image almanac or other formats, different than text but in other moments could be a text.
  • ProgressBarType. It renders a progress bar imagen at the moment is placed. But it could be configured to display a simple text or build a small Table to replicate the same purpose.
  • And more like this.
For all of this types we were able to place a simple {MERGEFIELD value}, and depending of its type, it was rendered to the correct type and with the right aspect using a complex Event. This is done for many document templates. I know this kind of logic could be implemented in one document with ReportingEngine but we need to simplify for all the templates without DRY (repeating ourselves) for all our templates.

Could be posible to launch an event every time is rendered a value when a ReportingEngine is working to do this custom logic? I find that the ReportingEngine fields for Images, Hypertexts etc. are fixed and defined into the document and that´s not suited for us.


Hi Gregorio,

Thanks for your inquiry.

Please note that LINQ Reporting Engine and the Mail Merge Engine are quite different. While dealing with Mail Merge and facing an unusual scenario, the first thing you normally would look at is Callbacks. For LINQ Reporting Engine, this should be a Custom Type. A custom type should not necessarily represent a domain entity (in terms of Domain-Driven Design), it can be a service or anything else. Support of custom types covers all scenarios where mail merge callbacks are needed.

Please refer to the following article:
LINQ Reporting Engine API

If you face any issue, please share your template and expected output documents for your use cases. We will then provide you more information about your query.


Perhaps with a little example it could be shown better my problema:

Supose we developed a type TicType with this constructor in C#:

TicType(string[] options, tileStyle style, int checkedOption);

The values v and w:

var v=new TicType(new string[]{"male","female","unknown"}, tileStyle.Horizontal, 1);

var w=new TicType(new string[]{"No","Yes"},tileStyle.Horizontal, 0)

v and w would be rendered in WORD by Aspose.Words MailMerge to:

[ ] male, [X] female, [ ] unknown
[X] No, [ ] Yes

(Note: Using Word checkboxes, not "[ ]" texts like in my example code. This editor does not allow me to draw checkboxes)

I know this could be made with some efforts in one document placing some logic into it. But what if we have thousands of templates with many fields of this type?. The only possibility would be to cut and paste the code logic for all the documents for every field of type TicType and that is not a solution. Events like used in MailMerge would resolve this issue cleanly. There are other posible solutions of course.


Hi Gregorio,

Thanks for your inquiry. As shared in my previous post, the LINQ Reporting Engine and the Mail Merge Engine are quite different. If you want to use LINQ Reporting, you need to modify your template documents and code.

In the shared scenario, we suggest you please use conditional blocks. Please refer to the following article. Hope this helps you.
Using Conditional Blocks