Link to home
Create AccountLog in
Avatar of alsam
alsam

asked on

Using values from vb.net app to pupulate Word template

Hi,
I have word template (Path:"c:\Word_template\Template.doc") in which I want to replace merge fields with the values from the text boxes in vb.net desktop application. Here is example:
In word template document I have:
<< First and Last name>>
<< Address>>
<<Postal code>>

In vb.net I have:
Textbox1 containing First and Last name
TextBox2 containing Address
TextBox3 cnatining Postal Code

I tried to find some code on the net which will do I want but with no success... I would appreciate your help a lot in order to provide me with code which will solve my problem...
Additionally, there is merge field in the same word template named << Detailed info>> which I would like to replace with my datagridview from my form in vb.net application... is it possibble and if yes I would appreciate a lot your help once more in order to make it works...

Regards...
Avatar of cubaman_24
cubaman_24
Flag of Spain image

Hello:
Try using an xslt template. It's incredible fast and easy. Also, you won't need to recompile your application if later the document template is modified.
http://weblogs.asp.net/cnagel/archive/2004/09/25/234188.aspx
Best regards.
Avatar of alsam
alsam

ASKER

Hello cubaman 24,

Thank you for your reply...
In the meanwhile I have successfully wrote the vb code which replace my bookmarks in word document and it works OK....
Unfortunatelly I have no idea how to show data in word document reflecting datagridview on the form... Actually I should show data from dataset/datatable in table in word...do you have any idea how to make this working...

Thanks
SOLUTION
Avatar of cubaman_24
cubaman_24
Flag of Spain image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
ASKER CERTIFIED SOLUTION
Avatar of Nasir Razzaq
Nasir Razzaq
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Avatar of alsam

ASKER

Thanks...