How to integrate MS Word to my .NET Application?

G

Guest

Hi,

My requirements are
1) There are predefined Headings (Heading1, Heading1.1, Heading1.1.1 and
....) in database and one set of these headings is called Template1 and
another set of these headings is called Template2 and so on.
2) User login and selects a template and selects the content. For example
content1 to heading1 and content2 to heading2 and so on. In this way after
selecting user clicks a button. The functionality of this button is to take
all the details supplied in the form and process or generates a MS Word
document which will have all the contents supplied in selected Headings.

Can anybody help me in doing or give me an idea how to go about this
application.

Thanks & Regards,
Narayana.
 
G

Guest

Hi Narayana,

If I'm on the right track with this, you want Word to run on the client
computer?

The only way I believe of doing this is to use VBScript to run the Microsoft
Word ActiveX component. Basically, you use VB/C# to write a VBScript which is
then executed by the client browser.

2 problems... it only works with IE, which if you're building an intranet is
not so much of a problem. Secondly, a security dialog pops up asking you to
confirm the running of the Word ActiveX control (why the Word ActiveX isn't
signed is just bizarre).

It does work though, and if you're interested I've written a wrapper class
for the script creation code. Email me (addy below) if you want a copy!

Cheers


Dan
dan at musoswire dot com
 
G

Guest

Hi Narayana,
For each and every template create a seperate dot files (template1.dot
[I think you know that all the documents which are created in MSWord will use
normal.dot file]). Create a reference to Word InterOp assembley (Word 11.0
library). You can do the following Items.
- create a work document with specific dot file
- Add para and apply specific styles (Heading1...)

For more info see
http://msdn.microsoft.com/office/understanding/word/articles/default.aspx

Thanks,
Ragu


Thanks,
Ragu
 
T

thinkfr33ly

In general, this whole approach is a very bad idea.

The reason being that Word was never meant for unattended execution. It
has the potential to popup modal dialog boxes on invisible desktops on
your server, potentially bringing down your entire application until
you kill the instance(s) of Word and restart the web app.

Look for an alternative 3rd party application to do what you're looking
for.
 
G

Guest

That's very true.

This is why the code I was on about earlier actually calls Word on the
client to avoid this very problem. Pretty much IE only though.

I have to say... I always thought clicking a button on 1 machine and
watching word execute on the server was quite amusing for at least the first
couple of goes.... :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,438
Messages
2,571,699
Members
48,796
Latest member
Greg L.
Top