We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Using DocIO MailMerge with Entity Framework

Thread ID:





130832 Jun 6,2017 11:59 AM UTC Jun 8,2017 01:25 PM UTC ASP.NET MVC 3
Tags: DocIO
Paul Kocher
Asked On June 6, 2017 11:59 AM UTC


I started using Syncfusion Essential Studio yesterday. Looks very good! :)

Unfortunately I couldn't figure out how (or IF it is possible) to use Entity Framework to populate the MergeFields in my document template.

I'd like to use a query like this:

ublic List<Employee> GetEmployees()
            var db = new CareContext();

            var employees = db.Employee
                .Select(e => new Employee()
                    LastName = m.LastName,
                    Vorname = m.FirstName,
                    SocialNo = m.SocialNo

            return employees;

Unfortunately I don't know how to continue from here.

Is this even possible? Looking forward to hearing from you.

Greets Paul

Paul Kocher
Replied On June 6, 2017 11:58 PM UTC

Sorry I know I haven't been much descriptive - the actual question is. And I haven't really found any up to-date information if the Syncfucsion MVC Suite does support Entity Framework at all. I just read "ADO.NET Object".

I'm new to programming so I just wonder. Would be nice if someone would reply ;)


Sethumanikkam Yogendran [Syncfusion]
Replied On June 7, 2017 09:16 AM UTC

Hi Paul,

Thank you for contacting Syncfusion support.

We have prepared the sample to meet your requirement and in this sample, we have done the following things.

     1. Loaded template Word document (which has mentioned merge fields) using Essential DocIO.
     2. Using EntityFramework approach, loaded field values as input for the fields.
     3. Performed Mail merge and saved resultant Word document using Essential DocIO.

Note: As per EntityFramework approach, we have modified the given code to achieve your requirement. Please find the modified code from below highlighted codes.
var employees = (from p in db.EmployeeDbSet
        select p).ToList()

    .Select(e => new Employee
        LastName = e.LastName,
        Vorname = e.Vorname,
        SocialNo = e.SocialNo

Please find the sample from below link, and let us know if this helps you.
Sample link
Note: Please find the code snippet in “HomeController.cs” file and used database file “db_Employee.mdf” from “App_Data” folder inside of sample application.

Please refer our UG link to know more about working with Mail merge using Essential DocIO.
Working with Mail merge

If we misunderstood any of your requirement, then kindly provide us sample or modified sample of above along with data’s used at your end and screenshot/output Word document of the expected result which will helpful to provide you the appropriate solution at the earliest.

Please let us know if you have any other questions.


Paul Kocher
Replied On June 8, 2017 01:25 PM UTC

Hello Sethumanikkam,

thank you so much :)


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon