Free Support Forum - aspose.com

Use Multiple Dataset in single Docx using LINQ

W have 2 dataset (ds1 and ds2) which are containing multiple tables and we want to use both datasets into single document template.
We have below relations in dataset

ds1 = Table1 -----------> Table2
And
ds2= Table3

Still now i am able to pass only single dataset to docx plz check below code for same.

ReportingEngine engine = new ReportingEngine();
engine.buildReport(doc, Object , “ds1”);

so How do i pass multiple dataset to documents? Please suggest and provide me sample code for same.

@bhausa661975

Thanks for your inquiry. Please use ReportingEngine.BuildReport (Document, Object[], String[]) method to populate the specified template document with data from the specified sources making it a ready report.

i have java model object hierarchy please check attachment for same. And we want to use these in template by using LINQ Engine. But as per documentation we need to build dataset and datatable for these hierarchy and need to pass dataset to engine. is there any way to use these hierarchy directly in template without convert into Datset/Table ? Is there any way to construct dataset/Datatable using aspose utility ? Please guide me on same.
proposal.jpeg (28.7 KB)

Thanks,
Bhausaheb

@bhausa661975

Thanks for your inquiry. You do not need to convert your data source into DataSet/DataTabe. In your case, we suggest you please read the following documentation link.
Appendix C. Typical Templates

Please also check the code examples about LINQ Reporting from Aspose.Words for Java examples repository at GitHub.

Hi Tahir,
I am using LINQ for DocGen but somehow in final documents blank line creating at place of expression. Is there any way of removing blank lines. Below is my code snippet.
<<if[cl.clientType==3 && cl.lifeSeq==0]>>

Life Insured/Person Covered : <<[cl.cPersonal.firstName]>> <<[cl.cPersonal.lastName]>> <</if>>

<<if[cl.clientType==3 && cl.lifeSeq==0]>>

Policy Owner/Participant : <<[cl.cPersonal.firstName]>> <<[cl.cPersonal.lastName]>> <</if>>

@bhausa661975

Thanks for your inquiry. In your case, we suggest you please use the IF syntax as shown below.

<<if[cl.clientType==3 && cl.lifeSeq==0]>>Life Insured/Person Covered : <<[cl.cPersonal.firstName]>> <<[cl.cPersonal.lastName]>> <</if>>