-
Notifications
You must be signed in to change notification settings - Fork 41
Added new kb article nested-mailmerge-radwordsprocessing #474
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
dessyordanova
merged 6 commits into
master
from
new-kb-nested-mailmerge-radwordsprocessing-d0b522c09f0c434bbcef2bb89b853381
Nov 20, 2024
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
092388c
Added new kb article nested-mailmerge-radwordsprocessing
bef4164
add links and images
dessyordanova 82befe1
Update nested-mailmerge-radwordsprocessing.md
dessyordanova 1b6ebf4
addressed review's feedback
dessyordanova ff617b9
Update nested-mailmerge-radwordsprocessing.md
dessyordanova 2bcd0ea
Merge branch 'new-kb-nested-mailmerge-radwordsprocessing-d0b522c09f0c…
dessyordanova File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| --- | ||
| title: Performing Nested MailMerge with Multiple Levels in RadWordsProcessing | ||
| description: Learn how to implement nested MailMerge operations with multiple levels of data, such as handling lists within lists, in RadWordsProcessing. | ||
| type: how-to | ||
| page_title: How to Handle Nested MailMerge with Multi-Level Data in RadWordsProcessing | ||
| slug: nested-mailmerge-radwordsprocessing | ||
| tags: wordsprocessing, mailmerge, nested, data, list, document, processing | ||
| res_type: kb | ||
| ticketid: 1668943 | ||
| --- | ||
|
|
||
| ## Environment | ||
|
|
||
| | Version | Product | Author | | ||
| | --- | --- | ---- | | ||
| | 2024.3.806| RadWordsProcessing |[Desislava Yordanova](https://www.telerik.com/blogs/author/desislava-yordanova)| | ||
|
|
||
| ## Description | ||
|
|
||
| Learn how to perform a [MailMerge]({%slug radwordsprocessing-editing-mail-merge%}) operation with multiple levels of nested data, such as a list within a list (e.g., `Incident` > `Person` > `Phones`) in [RadWordsProcessing]({%slug radwordsprocessing-overview%}). | ||
|
|
||
| ## Solution | ||
|
|
||
| To achieve a nested [MailMerge]({%slug radwordsprocessing-editing-mail-merge%} operation with multiple levels of data, follow the steps below: | ||
|
|
||
| 1. Prepare your data model to reflect the nested structure. In this case, the model includes `Incident`, `Person`, and `Phone` classes. | ||
|
|
||
| 2. Use the [MailMerge]({%slug radwordsprocessing-editing-mail-merge%}) method to merge the data with the document template. Ensure your document template has the appropriate merge fields defined for each level of data. | ||
|
|
||
| 3. Use special merge fields (`TableStart`, `TableEnd`, `RangeStart`, and `RangeEnd`) to denote the beginning and end of each nested collection. | ||
|
|
||
| Here is an example demonstrating how to set up your data model and perform the nested MailMerge: | ||
|
|
||
| ```csharp | ||
| // Define your data models | ||
| public class Incident | ||
| { | ||
| public string ReportNumber { get; set; } | ||
| public List<Person> People { get; set; } | ||
| } | ||
|
|
||
| public class Person | ||
| { | ||
| public string FirstName { get; set; } | ||
| public string LastName { get; set; } | ||
| public List<Phone> Phones { get; set; } | ||
| } | ||
|
|
||
| public class Phone | ||
| { | ||
| public string PhoneNumber { get; set; } | ||
| } | ||
|
|
||
| // Preparing the data | ||
| var mergeData = new List<Incident>{ | ||
| new Incident{ | ||
| ReportNumber = "INC-2024-001", | ||
| People = new List<Person>{ | ||
| new Person{ | ||
| FirstName = "John", | ||
| LastName = "Doe", | ||
| Phones = new List<Phone>{ | ||
| new Phone{ PhoneNumber = "310-555-0101" }, | ||
| new Phone{ PhoneNumber = "310-555-0102" } | ||
| } | ||
| }, | ||
| // Add more Person instances as needed | ||
| } | ||
| } | ||
| }; | ||
|
|
||
| // Perform the MailMerge operation | ||
| RadFlowDocument document = new RadFlowDocument(); | ||
| // Assume 'provider' is initialized and points to the appropriate document format provider | ||
| var mailMergeResult = document.MailMerge(mergeData); | ||
| ``` | ||
|
|
||
| In your document template, ensure you have the corresponding merge fields: | ||
|
|
||
| - For the start and end of the `People` list: `TableStart:People` and `TableEnd:People`. | ||
| - For the start and end of the `Phones` list within each `Person`: `RangeStart:Phones` and `RangeEnd:Phones`. | ||
| - For merging individual property values, use merge fields named after the properties, such as `FirstName`, `LastName`, and `PhoneNumber`. | ||
|
|
||
|  | ||
|
|
||
| ### Generating the Necessary Table Structure in the Document | ||
|
|
||
| When dealing with nested collections, it's crucial to dynamically create table structures that can accommodate the varying lengths of these collections. | ||
|
|
||
| By following these steps and utilizing the provided code snippets, you can effectively perform nested MailMerge operations with multiple levels of data in RadWordsProcessing. | ||
|
|
||
|  | ||
|
|
||
| ## See Also | ||
|
|
||
| - [MailMerge]({%slug radwordsprocessing-editing-mail-merge%}) | ||
| - [Generating a Word Document with Data Using MailMerge in RadWordsProcessing]({%slug generate-doc-template-and-populate-with-collection-data-mail-merge%}) | ||
| - [Populate a Table with Data using Nested Mail Merge Functionality]({%slug populate-table-data-mail-merge%}) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.