المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Problem with Process.Start("WINWORD.EXE", selectedFile); [modified]



C# Programming
05-21-2011, 10:54 AM
Problem with Process.Start("WINWORD.EXE", selectedFile);
I even put the entire path there: //string MSWordPath = @"c:\Program Files (x86)\Microsoft Office\Office14\WINWORD.EXE";
Still same result:

the path and file name is:
c:\Users\xxx\Documents\Visual Studio 2010\Projects\zMAP\bridgeWord-Html\bridgeWord-Html\bin\Debug\01 SettingsForVSC#.docx

The MSWord is lunched but these errors are thrown:
Microsoft Word
This file could not be found!
(c:\Users\xxx\Documents\Visual.doc)
(c:\Users\xxx\Documents\...\Studio.doc)
(c:\Users\xxx\Documents\...\01.doc)
(c:\Users\xxx\Documents\...\Studio.doc)
(c:\Users\xxx\Documents\...\SettingsForVSC#.doc)

And then an empty msword page is open.
[I see it breaks at the spaces in between names] ---How to fix this problem?
I wish to open not only a docx file, but a html file also,or a txt file.
thank you.

string path = Application.StartupPath;private void button3_Click(object sender, EventArgs e) { string MSWordPath = "\"c:\\Program Files (x86)\\Microsoft Office\\Office14\\WINWORD.EXE\""; selectedFile = path + "\\" + listBox1.SelectedItem as string; //Process.Start("WINWORD.EXE", selectedFile); -or this but the same problem Process.Start(MSWordPath, selectedFile); }
modified on Friday, May 20, 2011 1:13 PM