Incorporating a Sub-Report in DOCX

The steps below are to include sub reports in a report template:

1. Add Subreport Comment Markers

These markers define the section of the main report where the sub-report will be embedded:

  • Subreport Begin Marker
    Add the following marker where the sub-report begins in the template:

    /Elx/Detail/Sub
    
  • Subreport End Marker
    Add this marker at the point where the sub-report ends:

    /Elx/End/Sub
    

2. Map Subreport Data Source

To ensure the sub-report pulls the correct data, configure its data source:

  • Define the Data Source Name
    Specify the sub-report’s data source using this path. For example:

    /Elx/DataSource/Subreport/Name/DocX_Samples/DocX/datasource/FilteredOrderDetails.ds
    

    Ensure the .ds file aligns with the required dataset for the sub-report.

  • Add the Subreport Parameter
    Include a parameter that links the sub-report to the main report’s data. For example:

    /Elx/DataSource/Subreport/Parameter/OrderID/${=ID}
    

    This parameter dynamically retrieves the OrderID value from the main report to filter the sub-report data.

3. Verify Subreport Integration

After adding the markers and mapping the data source, confirm the following:

  • The sub-report renders within the designated area of the main report.
  • The parameter mapping correctly passes data from the main report to the sub-report.
  • All formatting and layout align with the specified requirements.

Sub report DOCX sample.zip (15.9 KB)