Click here to Skip to main content
15,888,401 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
I have a working ASP.NET web application to manage projects and customers. Now I want to generate a word file for some customers. In this file should be displayed some data about the customer. Every generated file should have the same data and the same design. So I want to craete a new Word Template with the fields and want to fill the placeholders programmatically.
Posted
Updated 20-Dec-11 23:13pm
v2

I did the same thing with Office Interop Services for .NET. Just create a word template file and make its structure then insert boomarks in every position that you want to add some information.

You can access to any bookmark by its name : WordApplication.ActiveDocument.Bookmarks["BookmarkName"] .

Then use its Range to insert table , text or image into that position.

Hope it helps.
 
Share this answer
 
Comments
janareddyjanareddy 21-Dec-11 5:27am    
can you give some more code
Amir Mahfoozi 21-Dec-11 5:35am    
read here : http://www.dotnetperls.com/word it is a good starting point. also use intellisense to see the list of available methods and properties.
RaisKazi 29-Dec-11 4:19am    
My 5.
Amir Mahfoozi 29-Dec-11 4:27am    
Thank you Rais :)
C#
WordApplication.ActiveDocument.Bookmarks["Your Bookmark name"]
 
Share this answer
 
v2
Comments
RaisKazi 29-Dec-11 4:19am    
My 5.
RaisKazi 29-Dec-11 4:20am    
Edit: Added "pre" tag.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900