Click here to Skip to main content
15,889,882 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi friends. I am creating an application which allows a user to open word within an C# application with WPF. Can you please help me with the code to open a word application within a group box. Thanks in advance.
Posted
Updated 12-Mar-16 10:27am
v2

Here is a way to open a word document :

Add a COM reference :
Microsoft Office 12.0 Object Library<br />


Then add the following namespace :

C#
using Microsoft.Office;
using office = Microsoft.Office.Interop.Word;


And then in the code where you want to use, add this :

C#
var wordApp = new office.Application();
Document document=wordApp.Documents.Open(//Specify the parameters)
 
Share this answer
 
I would simplify the problem by creating new Process.
Process.Start("winword.exe");

Opening word application within a group box is not a trivial task.
Regards
 
Share this answer
 
Comments
aditya behara 7-Apr-11 5:12am    
Can you elaborate this topic? I am creating a WPF application. I an using tab control in my application. And under a particular tab there is group box where I want to display the word application. Can you please upload the code that will be more explanatory.
Ciumac Sergiu 7-Apr-11 5:48am    
Process.Start will start Microsoft Word as a separate application. If you like to embed the Word app into your WPF you would rather want to consult P/Invoke topic proposed by Tarun.K.S.
A good start is here Office Development in Visual Studio[^]

Perhaps here you can find what you need.
 
Share this answer
 
v2
 
Share this answer
 

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