how can we open Ms word in C# Windows application ?
how can we open Ms word in C# Windows application ?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Marina EberhardtPosted Nov 13, 2014, 4:41 AM
If you just want to open MS Word application then you can do this:
System.Diagnostics.Process.Start(@"Winword.exe");
Mark ConorsPosted Mar 13, 2013, 1:32 AM
1) Use Office Interop:
http://www.mindstick.com/Articles/5cd1b721-9b94-4ea0-bd6e-2bb157401069/
http://zirmandli.wordpress.com/2007/07/04/read-word-doc-using-c/
http://www.4microsoftsolutions.com/post/Create-Open-Microsoft-Word-Document-in-C.aspx
http://nishantrana.wordpress.com/2007/11/03/creating-word-document-using-c/
2) If you work with .docx format only you may use OpenXML:
http://www.microsoft.com/en-us/download/details.aspx?id=5124
http://www.c-sharpcorner.com/Blogs/9051/
http://somecodesnippets.blogspot.ru/2012/05/how-to-create-word-document-with-c.html
3) You may use some 3rd party .Net components. For example look at this C# Word component
White EvalnPosted Oct 12, 2012, 4:19 AM
private void btnOpen_Click(object sender, EventArgs e)
{
//Open a Doc Document
OpenFileDialog dialog = new OpenFileDialog();
dialog.Filter="Word97-2003 files(*.doc)|*.doc|Word2007-2010 files (*.docx)|*.docx|All files (*.*)|*.*";
dialog.Title="Select a DOC file";
dialog.Multiselect=false;
dialog.InitialDirectory = System.IO.Path.GetFullPath(@"..\word to image.doc");
DialogResult result = dialog.ShowDialog();
if (result==DialogResult.OK)
{
try
{
// Load doc document from file.
this.docDocumentViewer1.LoadFromFile(dialog.FileName);
this.textBox2.Text = this.docDocumentViewer1.PageCount.ToString();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
but you need to download a .NET DocViewerSatyapriya NayakPosted Oct 9, 2012, 8:23 AM
Please refer the below links
http://www.c-sharpcorner.com/UploadFile/mgold/CreatingandOpeningMicrosoftDocumentfrom.NETUsingCSharp11262005050939AM/CreatingandOpeningMicrosoftDocumentfrom.NETUsingCSharp.aspx
http://www.codeproject.com/Articles/3959/Microsoft-Word-Documents-from-ASP-NET
Thanks