Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Repeating content outside of tables in Word templates

(3) ShareShare
ReportReport
Posted on by 12

Hi,

I've created a Word template using a primary entity and added a related entity with a 1:N relationship. I added a table and inserted some fields from the related entity – it works fine.

 

Now I'd like to display this repeating data outside of a table, for example in a numbered list or with some text in between fields

I tried adding a Repeating Content Section Control manually and mapping it to the relationship, but it doesn't seem to work.

 

Are repeating items strictly supported only within tables? Or is there a way to format repeating data outside of a table in Word Templates?

 

Thanks!

 
Categories:
  • OM-24051546-0 Profile Picture
    12 on at
    Repeating content outside of tables in Word templates
    Can you tell us what Dynamics 365 application this question is related to? There are several different solutions in the Dynamics 365 family, like: Sales, Finance, Supply Chain Management, Project Operations, and Business Central. Or are you using an ISV solution for managing the Word templates?
     
    My application is a Custom Model-Driven App in Dynamics 365, so it's not one of the pre-installed apps like Sales, Finance, or others.
    I'm using the default integration with word template (documenttemplate) and not using any third party software.
  • André Arnaud de Calavon Profile Picture
    294,941 Super User 2025 Season 1 on at
    Repeating content outside of tables in Word templates
    Can you tell us what Dynamics 365 application this question is related to? There are several different solutions in the Dynamics 365 family, like: Sales, Finance, Supply Chain Management, Project Operations, and Business Central. Or are you using an ISV solution for managing the Word templates?
  • Suggested answer
    Daivat Vartak (v-9davar) Profile Picture
    7,336 Super User 2025 Season 1 on at
    Repeating content outside of tables in Word templates
    Hello OM-24051546-0,
     

    You are correct. Repeating content in Word templates for Dynamics 365 is primarily designed and best supported within tables.

    While Word offers the "Repeating Content Control" feature, its direct integration and data binding capabilities within the context of Dynamics 365 Word templates are optimized for tabular data.

    Why it's difficult outside tables:

    • Data Structure Mapping: The Dynamics 365 Word template engine iterates through the related records and naturally maps each record's fields to the rows of a table. This creates a clear and structured way to present the repeating data.

    • Context and Boundaries: Tables provide clear boundaries for each repeating record. The engine knows where one record's data ends and the next begins. Outside of a table, defining these boundaries for repeating sections becomes ambiguous.

    • Formatting Complexity: Trying to manage formatting (like numbering, spacing, or specific text between fields) for a dynamic number of repeating items outside a table can be very complex and unreliable with the current Word template integration.


    •  

    Workarounds and Considerations (with limitations):

    While a direct, clean solution for repeating content outside tables is limited, here are some approaches you could explore, keeping in mind their drawbacks:

    1. Multiple Calculated Fields and Conditional Visibility (Limited Number of Repeats):

      • If you know the maximum number of related records you might have, you could create that many sets of calculated fields in your primary entity.

      • Each set of calculated fields would retrieve data from a specific related record (e.g., "Related Entity 1 - Field A", "Related Entity 1 - Field B", "Related Entity 2 - Field A", etc.).

      • You would then use conditional visibility in your Word template to show/hide these sets of fields based on whether the corresponding related record exists.

      • Drawbacks: This is only feasible for a small, predictable maximum number of related records. It becomes very cumbersome and inefficient for a potentially large or variable number of repeats.

      •  

    2. JSON Data and Custom Code (More Complex):

      • You could potentially retrieve the related data as a JSON string within a calculated field on the primary entity.

      • In your Word template, you would then need to use more advanced Word features (potentially involving VBA or third-party add-ins) to parse this JSON and format it as a list.

      • Drawbacks: This requires significant technical expertise in both Dynamics 365 development and advanced Word functionalities. It's not a standard Word template feature and can be prone to breaking with updates.

      •  

    3. Power Automate (Flow) to Pre-format the Data:

      • You could create a Power Automate flow that runs when the primary record is created or modified.

      • This flow would retrieve the related records and format the data into a single text field on the primary entity in your desired list format (e.g., "1. Value A - Value B\n2. Value C - Value D").

      • You would then insert this single pre-formatted text field into your Word template.

      • Drawbacks: This moves the formatting logic outside the Word template. Changes to the desired format would require modifying the flow. It also results in a single block of text, making fine-grained formatting within the template difficult.

      •  

    4. Consider Restructuring Your Template:

      • If the visual presentation allows, try to incorporate the repeating data within a table, even if it's a table with only one column or a specific layout that mimics a list. You can often style tables in Word to minimize the visual appearance of borders. 

      •  

    In summary, while the desire to format repeating data outside of tables is understandable, the native Word template integration with Dynamics 365 is heavily optimized for tabular structures. Direct and reliable repetition of content outside tables without significant workarounds or limitations is not a primary feature.

    For your specific use case of a numbered list with text in between fields, the most practical approach within the standard Word template capabilities is likely to simulate the list appearance using a table. You can achieve this by:

    • Creating a table with the necessary number of columns for your fields and any static text.

    • Inserting the Dynamics 365 fields within the table cells.

    • Using Word's numbering features on the first column of the table to create the numbered list.

    • Carefully adjusting table borders and cell padding to achieve the desired visual layout and minimize the appearance of the table structure.

    •  

    While not ideal, this approach leverages the supported repeating content within tables and uses Word's formatting capabilities to approximate your desired list format. The other workarounds mentioned above involve more complexity and potential drawbacks.

     
    If my answer was helpful, please click Like, and if it solved your problem, please mark it as verified to help other community members find more. If you have further questions, please feel free to contact me.
     
    My response was crafted with AI assistance and tailored to provide detailed and actionable guidance for your Microsoft Dynamics 365 query.
     
    Regards,
    Daivat Vartak

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Siv Sagar Profile Picture

Siv Sagar 149 Super User 2025 Season 1

#2
Vahid Ghafarpour Profile Picture

Vahid Ghafarpour 80 Super User 2025 Season 1

#3
Sohail Ahmed Profile Picture

Sohail Ahmed 70

Overall leaderboard

Product updates

Dynamics 365 release plans