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. Image for the cookie policy date

Using DocIO MailMerge with Entity Framework


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

3 Replies

PK Paul Kocher 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 ;)


SY Sethumanikkam Yogendran Syncfusion Team 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.


PK Paul Kocher June 8, 2017 01:25 PM UTC

Hello Sethumanikkam,

thank you so much :)

Live Chat Icon For mobile
Up arrow icon