I want to create a doc that uses the same template (layout) in every page.
The target is read info from a sql server database, where each line is a client info (name, phone, addresss, image, etc), bind the client values in a template (doc or dot), and add it to a new doc.
Each client will have a page in the doc, with same layout but with info relative to the client, and the result will be a unique doc with the number of pages as the number of clients in the DB.
So, I want to retrive all info formated in document, but in a only file with a page for client.
This control have many web control like: label1,label2, textbox1 etc. And this control will help you to display your message.
2.If you know how to control the formate, use
CSS to this UserControl. If you want to retain the default formate when the document uploaded by other pepole.(like
google books) You need Flash
weierstrass
Member
5 Points
14 Posts
Create Word doc with same template for each page
Jan 25, 2012 10:41 AM|LINK
Hi!
I want to create a doc that uses the same template (layout) in every page.
The target is read info from a sql server database, where each line is a client info (name, phone, addresss, image, etc), bind the client values in a template (doc or dot), and add it to a new doc.
Each client will have a page in the doc, with same layout but with info relative to the client, and the result will be a unique doc with the number of pages as the number of clients in the DB.
So, I want to retrive all info formated in document, but in a only file with a page for client.
How can I do it in .net c# or asp.net c#
Thank's
Hugo
Dino He - MS...
Star
8068 Points
1023 Posts
Microsoft
Re: Create Word doc with same template for each page
Jan 29, 2012 05:04 AM|LINK
Hi
I think you need do 2 things.
1. You need to create a UserControl.
This control have many web control like: label1,label2, textbox1 etc. And this control will help you to display your message.
2.If you know how to control the formate, use CSS to this UserControl. If you want to retain the default formate when the document uploaded by other pepole.(like google books) You need Flash
If you have any feedback about my replies, please contact msdnmg@microsoft.com
Microsoft One Code Framework
marko4
Member
320 Points
78 Posts
Re: Create Word doc with same template for each page
Jan 29, 2012 08:48 PM|LINK
there is a way which i have used, ..
create the rtf document or html document with the propper formating that you want, and then use this code to convert it to word format
Microsoft.Office.Interop.Word.Application wdApp = new Microsoft.Office.Interop.Word.Application(); Microsoft.Office.Interop.Word.Document wdDoc = wdApp.Documents.Open(htmlfile, Type.Missing, Type.Missing, false); string fname = "f1.doc"; wdDoc.SaveAs(fname, Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatDocument, Type.Missing, Type.Missing, false); wdDoc.Close(false); wdApp.Quit();you need to add a refrence to Microsoft.Office.Interop.Word