Performing Nested Mail merge with relational data objectsĮssential DocIO supports performing nested Mail merge with implicit relational data objects without any explicit relational commands by using the ExecuteNestedGroup overload method. You can perform Mail merge with business objects in a template document. Performing Mail merge with business objects Performing Mail merge with dynamic objectsĮssential DocIO allows you to perform Mail merge with the dynamic objects. You can perform nested Mail merge with relational or hierarchical data source and independent data tables in a template document. You can perform Mail merge and append multiple records from data source within a specified region to a template document. The MailMerge class provides various overloads for the Execute method to perform Mail merge from various data sources. You can download a complete working sample from GitHub.īy executing the previous code example, it generates the resultant Word document as follows. Close () //Download the helper files from the following link to save the stream as file and open the file for viewing in Xamarin platform. SaveAndView ( "Sample.docx", "application/msword", stream ) //Closes the document document. Docx ) //Save the stream as a file in the device and invoke it for viewing Xamarin. Execute ( fieldNames, fieldValues ) //Saves the Word file to MemoryStream MemoryStream stream = new MemoryStream () document. Docx ) string fieldNames = new string //Performs the mail merge document. GetManifestResourceStream ( "" ), FormatType. Assembly WordDocument document = new WordDocument ( assembly. Opens the template document Assembly assembly = typeof ( App ). The following code example shows how to perform mail merge in above Word document template using string arrays as data source. You can download a complete working sample from GitHub. SaveAndView ( "Template.docx", "application/msword", stream ) //Download the helper files from the following link to save the stream as file and open the file for viewing in Xamarin platform. Close () //Save the stream as a file in the device and invoke it for viewing Xamarin. Docx ) //Closes the Word document document. FieldMergeField ) //Saves the Word document to MemoryStream MemoryStream stream = new MemoryStream () document. EnsureMinimal () //Appends merge field to the last paragraph. Creates an instance of a WordDocument WordDocument document = new WordDocument () //Adds a section and a paragraph in the document document. The following code example shows how to create a merge field in the Word document. You can create Word document template programmatically by adding merge fields to the Word document using Essential DocIO. You need to add a prefix (“Image:”) to the merge field name for merging an image in the place of a merge field.įor example: The merge field name should be like “Image:Photo” («Image:MergeFieldName») The following screenshot shows how to insert a merge field in the Word document by using the Microsoft Word. By using Word editor application, you can take the advantage of the visual interface to design unique layout, formatting, and more for your Word document template interactively. You can create a template document with merge fields by using any Word editor application, like Microsoft Word. You can replace the fields ( IF, Formula) combined with merge fields, with its most recent result and generates the plain Word document by unlinking the fields.To use conditional fields, execute mail merge and then update fields in the Word document using UpdateDocumentFields API. You can use conditional fields ( IF, Formula) combined with merge fields, when you require intelligent decisions in addition to simple mail merge (replace merge fields with result text). Template Word document: This document contains the static or templated text and graphics along with the merge fields (that are placeholders) for replacing dynamic data.ĭata source: This represents file or database containing data to replace the merge fields in template Word document.įinal merged document: This resultant document is a combination of the template Word document and the data from data source. The mail merge process involves three documents: The following data sources are supported by Essential DocIO for performing Mail merge: The WMergeField instance is replaced with the actual data retrieved from data source for the given merge field name in a template document. The WMergeField class provides support to bind template document and data source. Mail merge is a process of merging data from data source to a Word template document.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |