Use Timer to close MSWord App about 1 second after it is used.
Check to see if the Bars exist before removing them Add 1 point to the width of boxed text to get proper Line-Wrapping
This commit is contained in:
@@ -662,16 +662,48 @@ namespace VEPROMS.CSLA.Library
|
||||
myDoc.PageSetup.BottomMargin = (11 * 72) - newLength;
|
||||
}
|
||||
}
|
||||
|
||||
//public static void CloseApp()
|
||||
//{
|
||||
// WaitMS(900);// This was added because MSWord will sometimes get the error below
|
||||
// // Microsoft Office Word has stopped working
|
||||
// // It appears that this is caused by quiting the MS Word application
|
||||
// // to soon after closing the document or doing an export.
|
||||
// MyApp.Quit(false);
|
||||
// _MyApp = null;
|
||||
//}
|
||||
/// <summary>
|
||||
/// This closes the MS Word Application, but, delays for about 1 second.
|
||||
/// It appears that closing MSWord to quickly causes a:
|
||||
/// "Microsoft Office Word has stopped working" error.
|
||||
/// </summary>
|
||||
public static void CloseApp()
|
||||
{
|
||||
WaitMS(300);// This was added because MSWord will sometimes get the error below
|
||||
// Microsoft Office Word has stopped working
|
||||
// It appears that this is caused by quiting the MS Word application
|
||||
// to soon after closing the document or doing an export.
|
||||
MyApp.Quit(false);
|
||||
System.Windows.Forms.Application.DoEvents();
|
||||
new CloseWordApp(_MyApp, 1000);
|
||||
_MyApp = null;
|
||||
}
|
||||
private class CloseWordApp:System.Windows.Forms.Timer
|
||||
{
|
||||
LBApplicationClass _MyApp;
|
||||
public LBApplicationClass MyApp
|
||||
{
|
||||
get { return _MyApp; }
|
||||
set { _MyApp = value; }
|
||||
}
|
||||
public CloseWordApp(LBApplicationClass myApp, int interval)
|
||||
{
|
||||
MyApp = myApp;
|
||||
Interval = interval;
|
||||
Tick += new EventHandler(CloseWordApp_Tick);
|
||||
Enabled = true;
|
||||
}
|
||||
void CloseWordApp_Tick(object sender, EventArgs e)
|
||||
{
|
||||
Enabled = false;
|
||||
MyApp.Quit(false);
|
||||
Dispose();
|
||||
}
|
||||
}
|
||||
private static void WaitMS(int n)
|
||||
{
|
||||
DateTime dtw = DateTime.Now.AddMilliseconds(n);
|
||||
|
Reference in New Issue
Block a user