?
Solved

Creating Merge Documents with data via OpenXml

Posted on 2014-12-08
3
Medium Priority
?
1,414 Views
Last Modified: 2014-12-29
Hi,
How do i create "mail merge", via openxml in my c# (mvc) code from template?

i have template document .docx extension, in the document there are properties.
I succeed to fill just one document, but i want to create documents in one file, with data from query or somewhere else.
for example, i have view that return 10 people data (name, address)
i have a document with text, and dynamic name and address,
my result should be 10 documents, one for each person, and all in one file, so i can print it or whatever i want.

Please I've tried everything :(
best regards,
Arie
0
Comment
Question by:aweigh
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 37

Expert Comment

by:Neil Russell
ID: 40500198
Create a NEW document for your merge and then use the "Open XML SDK" to Merge the template document into the New document.

Example on TechNet
0
 

Author Comment

by:aweigh
ID: 40500239
Hi
That's doesn't what i meant to,
I have template document with "plain text" objects, I want to replace the "plain text" with data from SQL, LinQ, List view etc. and create on run time many documents, even over 100 pages, and all should be with good perfomance , like in  memory stream.
exactly, like it's done in word template file (".dotx") with link data.

Thanks,
Arie
0
 
LVL 37

Accepted Solution

by:
Neil Russell earned 2000 total points
ID: 40500271
Your starting point is going to be the OPEN XML SDK.
By "Plain Text Objects" do you mean merge fields? If not then why not? thats what mailmerge is all about, replacing fields with data.

Another great article with a working example can be found HERE

Don't try to reinvent the wheel when there are working toolkits already written that do the job.  

If you still have questions, ask away.
0

Featured Post

Linux Academy Android App Now Supports Chromecast

We have some fantastic news for our Android fans. We’re so excited to announce that the Linux Academy Android app is now available with Chromecast support. That’s right – simply download the latest update of the Linux Academy App and start casting your favorite course videos!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question