Loading
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Satyapriya NayakRank #47 · 31.5K reputationPosted Oct 9, 2012, 4:23 AM EDT
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
White Evaln26 reputationPosted Oct 12, 2012, 12:19 AM EDT
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 DocViewerMark Conors8 reputationPosted Mar 12, 2013, 9:32 PM EDT
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
Marina Eberhardt24 reputationPosted Nov 12, 2014, 11:41 PM EST
If you just want to open MS Word application then you can do this:
System.Diagnostics.Process.Start(@"Winword.exe");