.NET (C#) and Word Application

E

Emil

Hi all,

I’m a C++ developer and a very beginner in both C# (.Net) and Word
Programming. What my company wants next is something like this: from
different texts to build a Word 2007 document and then open this in the real
Word 2007 application to give the user the possibility to change the document
as usual with all possibilities (Menüs, Panels, etc.). Well my problem is
that the Word 2007 must be embedded in our C# - Application (WinForms).
Knows somebody a solution to do this: embed the Word 2007 application in
WinForms or if better maybe in WPF? For any idea thank you in advance.

Best Regards,
Emil
 
M

Michael Nemtsev [MVP]

Hello Emil,

Start from there http://msdn2.microsoft.com/en-us/office/aa905533.aspx to
get understandin' how to do this and
u need VSTO samples from there http://msdn2.microsoft.com/en-us/vs2005/aa718334.aspx

---
WBR,
Michael Nemtsev [.NET/C# MVP] :: blog: http://spaces.live.com/laflour

"The greatest danger for most of us is not that our aim is too high and we
miss it, but that it is too low and we reach it" (c) Michelangelo


E> Hi all,
E>
E> I’m a C++ developer and a very beginner in both C# (.Net) and Word
E> Programming. What my company wants next is something like this: from
E> different texts to build a Word 2007 document and then open this in
E> the real
E> Word 2007 application to give the user the possibility to change the
E> document
E> as usual with all possibilities (Menüs, Panels, etc.). Well my
E> problem is
E> that the Word 2007 must be embedded in our C# - Application
E> (WinForms).
E> Knows somebody a solution to do this: embed the Word 2007 application
E> in
E> WinForms or if better maybe in WPF? For any idea thank you in
E> advance.
E> Best Regards,
E> Emi
 
N

Nicholas Paldino [.NET/C# MVP]

Emil,

In addition to what Michael mentioned, the only way to embed a Word
document into .NET is to do it through the WebBrowser control (basically,
save the document to disk and then load it into the web browser).

You do contradict yourself by saying that you want to open the document
in the real Word 2007 application, and then embed it in your program. While
you can embed the document in your program, embedding the application isn't
such a good idea. Also, Office 2007 fundamentally changed the way they
handle their UI, so you can't just expect the menu merges to work completely
when embedding the document in your app.

Your best bet is to create the document XML yourself, and package it
yourself and then use Word 2007 to work with it. You can use the classes in
the System.Xml namespace to generate the actual XML (Office 2007 documents
are really nothing more than XML files packaged in a zip file) and then the
classes in the System.IO.Packaging namespace to package all the components
together.

You will want to search for examples of how to create a document using
XML tools as well, which should be relatively easy to find.
 

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

Top