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

Free Support Forum - aspose.com

LINQ Reporting Engine vs Mail Merge Template

Hi Team,


We are planning to use Aspose Words for Java for generating reports from Docx templates. We have requirements of rendering content in templates based on complex conditions and iterations. We are considering templating language as either Mail Merge or LINQ. As LINQ is more powerful in terms of features, we are leaning towards the same. It would be great if you can answer the following questions in this regard :

1. Does having LINQ as the templating language add any performance overhead over document generation?
2.Does LINQ report engine supports generating report from XML data?
3. Does LINQ based report generation support adding call backs (as in Mail Merge call backs) to control the document generation part?

Thanks in advance,
Manu

Hi Manu,


Thanks for your interest in Aspose.Words for Java. Yes, LINQ Reporting Engine enables you to build reports using an extended set of reporting features. Please refer to the articles mentioned in the following section of documentation:

LINQ Reporting Engine Programmers Guide

Manu:
1. Does having LINQ as the templating language add any performance overhead over document generation?
Like any operation, building a report adds an overhead; however, comparing with old Aspose.Words Mail Merge Engine, the overhead should be less in the most cases.
Manu:
2.Does LINQ report engine supports generating report from XML data?
2. Yes. LINQ Reporting Engine can accept a DataSet object as a data source. Please refer to the articles mentioned in the following section of documentation for more information on how to bind templates with DataSet, DataTable objects:

Working with Traditional Mail Merge Data Sources

Also, a DataSet instance can be built using an XML file or stream using “com.aspose.words.net.System.Data.DataSet.readXml” method
Manu:
3. Does LINQ based report generation support adding call backs (as in Mail Merge call backs) to control the document generation part?
Callbacks are currently not used with LINQ Reporting Engine as theoretically you can build callback-less template. Instead, any instance and static members of any custom types can be used directly in templates in places where Mail Merge requires callbacks. If you still think that you need a callback, please clarify your requirements in detail. We will forward details of your usecase to our product team and provide you more information.

Please let us know if we can be of any further assistance.

Best regards,

Hi Team,


Thanks for the detailed response. My doubt was specifically on how we can do conditional formatting with LINQ report engine. For example, I have a scenario where a specific data item in a table column should appear in bold, based on some condition. From the tutorial, I found that the option, ‘-html’ can be used to render the content as HTML string. This means that I need to format the data element prior to binding them in the document. Is there a better approach available?

Regards,
Manu

Hi Manu,


Thanks for your inquiry. We are checking this scenario and will get back to you soon.

Best regards,

Hi Manu,


Conditional formatting is supported by LINQ Reporting Engine through conditional blocks. Please use the following sample code against the attached template file for better understanding.

TestConditionalFormatting(true);

TestConditionalFormatting(false);


private static void TestConditionalFormatting(bool isBold)

{

Document document = new Document(@"D:\\Temp\\ConditionalFormatting.docx");

ReportingEngine engine = new ReportingEngine();

engine.BuildReport(document, isBold, "isBold");

document.Save(@"D:\\Temp\\Out " + isBold + ".docx");

}


I hope, this helps.

Best regards,