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:
Rich 2011-04-27 13:13:09 +00:00
parent 6ae9eb9653
commit 601632f019
3 changed files with 40 additions and 7 deletions

View File

@ -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);

View File

@ -293,6 +293,7 @@ namespace Volian.Controls.Library
myTabItem.MyDSOTabPanel.CloseDSO();
}
}
if (((Bar)sender).Items == null) return;
if (((Bar)sender).Items.Count == 1)// Remove bar if last item is closed...
{
Bar bar = sender as Bar;

View File

@ -1294,7 +1294,7 @@ namespace Volian.Print.Library
if (bxIndx != null)
{
Box bx = formatInfo.PlantFormat.FormatData.BoxList[(int)bxIndx];
Width = _WidthAdjustBox + (float)bx.TxtWidth - tabWidth;
Width = _WidthAdjustBox + (float)bx.TxtWidth - tabWidth; // add 1 to get it to wrap like 16Bit
}
else if (itemInfo.IsHigh)
{