B
BLiu
Guest
Hi,
I am trying to write a class which can open file with selected application. for simplicity, now I just hard code the varaibles.
the problem: if the path or file name has space in it, even it exist, winword still can not open it.
could someone kindly show me what I did wrong and how to do it properly.
Thanks in advance.
Belinda
________________
public static class FileOpen
{
public static void info()
{
string path = @"c:\a temp folder\aaa 1.txt";
if (File.Exists(path))
{
// the file I am using in the sample does exist
MsgBox.info("yes");
}
else
{
MsgBox.info("no");
}
// working
//Process.Start("winword", "c:\\aaa.txt");
// not working
//Process.Start("winword", "c:\aaa.txt");
// not working
Process.Start("winword", "c:\\a temp folder\\aaa 1.txt");
// not working
Process.Start("winword", path);
Continue reading...