A
Alan T
I have created a mail merged document at run time.
However, I cannot open the document everytime, sometime it did not get
opened, sometimes it can.
The document may be Word or text file.
public static void OpenDocument(string aFilename)
{
IntPtr result;
Process convertProcess = new Process();
try
{
convertProcess.StartInfo.Domain = "";
convertProcess.StartInfo.FileName = aFilename;
convertProcess.StartInfo.CreateNoWindow = true;
convertProcess.StartInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Maximized;
convertProcess.StartInfo.StandardErrorEncoding = null;
convertProcess.StartInfo.StandardOutputEncoding = null;
convertProcess.StartInfo.UseShellExecute = true;
convertProcess.StartInfo.LoadUserProfile = false;
convertProcess.StartInfo.Password = null;
convertProcess.StartInfo.UserName = "";
convertProcess.Start();
convertProcess.Dispose();
}
catch (Exception e)
{
try
{
convertProcess.Dispose();
}
catch
{
}
}
}
However, I cannot open the document everytime, sometime it did not get
opened, sometimes it can.
The document may be Word or text file.
public static void OpenDocument(string aFilename)
{
IntPtr result;
Process convertProcess = new Process();
try
{
convertProcess.StartInfo.Domain = "";
convertProcess.StartInfo.FileName = aFilename;
convertProcess.StartInfo.CreateNoWindow = true;
convertProcess.StartInfo.WindowStyle =
System.Diagnostics.ProcessWindowStyle.Maximized;
convertProcess.StartInfo.StandardErrorEncoding = null;
convertProcess.StartInfo.StandardOutputEncoding = null;
convertProcess.StartInfo.UseShellExecute = true;
convertProcess.StartInfo.LoadUserProfile = false;
convertProcess.StartInfo.Password = null;
convertProcess.StartInfo.UserName = "";
convertProcess.Start();
convertProcess.Dispose();
}
catch (Exception e)
{
try
{
convertProcess.Dispose();
}
catch
{
}
}
}