B2018-088 - Corrected logic to handle partially processed ROs so that the code will not crash. Also changed the Error Log message to be more useful.
B2018-089 - Changed the Error Log message to be more useful when Word refuses to adjust Document margins during print.
This commit is contained in:
@@ -842,7 +842,8 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_MyLog.Error("Could not Adjust Margins", ex);
|
||||
AddErrorLogInfoMarginNotFixed(sect,"Word section could not adjust margins"); // B2018-089 - Made error log output more useful
|
||||
//_MyLog.Error("Could not Adjust Margins", ex);
|
||||
}
|
||||
LBSelection selxy = hasRos ? FindXyPlot() : null;
|
||||
string pngFile = VlnSettings.TemporaryFolder + @"\XYPlot1.png"; //@"C:\Temp\XYPlot1.png";
|
||||
@@ -1101,6 +1102,16 @@ namespace VEPROMS.CSLA.Library
|
||||
return fileName;
|
||||
}
|
||||
}
|
||||
private static void AddErrorLogInfoMarginNotFixed(ItemInfo sect,string msg)// B2018-089 - Made error log output more useful
|
||||
{
|
||||
_MyLog.WarnFormat("\r\n==> {0}\r\n" +
|
||||
" [{1}] {2}\r\n" +
|
||||
" in {3}\r\n" +
|
||||
" Document: {4}\r\n" +
|
||||
" ACTION REQUIRED: Should use Word Margins",
|
||||
msg, sect.ItemID, sect.ShortPath,
|
||||
sect.SearchDVPath.Replace("\a", "/"), sect.MyContent.MyEntry.MyDocument.LibTitle ?? sect.MyContent.MyEntry.DocID.ToString());
|
||||
}
|
||||
private static PointF GetLocation(LBSelection sel, bool adjustMargins)
|
||||
{
|
||||
LBRange rng0 = MyApp.ActiveDocument.Range(0, 0);
|
||||
@@ -1357,11 +1368,13 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
if (_MySection != null)
|
||||
{
|
||||
_MyLog.ErrorFormat("<<< ERROR >>> MSWord could not set margins\r\n==>'MSWord could not set margins',{0},'{1}','{2}'"
|
||||
, _MySection.ItemID, _MySection.MyDocVersion.MyFolder.Name, _MySection.ShortPath);
|
||||
AddErrorLogInfoMarginNotFixed(_MySection, "MSWord could not set Section margins");// B2018-089 - Made error log output more useful
|
||||
//_MyLog.ErrorFormat("<<< ERROR >>> MSWord could not set margins\r\n==>'MSWord could not set margins',{0},'{1}','{2}'"
|
||||
// , _MySection.ItemID, _MySection.MyDocVersion.MyFolder.Name, _MySection.ShortPath);
|
||||
}
|
||||
else
|
||||
_MyLog.ErrorFormat("Could not set margins {0}", myDoc.FullName);
|
||||
AddErrorLogInfoMarginNotFixed(myDoc, "MSWord could not set Document margins");// B2018-089 - Made error log output more useful
|
||||
//_MyLog.ErrorFormat("Could not set margins {0}", myDoc.FullName);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -1378,11 +1391,13 @@ namespace VEPROMS.CSLA.Library
|
||||
{
|
||||
if (_MySection != null)
|
||||
{
|
||||
_MyLog.ErrorFormat("<<< ERROR >>> MSWord could not set margins\r\n==>'MSWord could not set margins',{0},'{1}','{2}'"
|
||||
, _MySection.ItemID, _MySection.MyDocVersion.MyFolder.Name, _MySection.ShortPath);
|
||||
AddErrorLogInfoMarginNotFixed(_MySection, "MSWord could not set Section margins");// B2018-089 - Made error log output more useful
|
||||
//_MyLog.ErrorFormat("<<< ERROR >>> MSWord could not set margins\r\n==>'MSWord could not set margins',{0},'{1}','{2}'"
|
||||
// , _MySection.ItemID, _MySection.MyDocVersion.MyFolder.Name, _MySection.ShortPath);
|
||||
}
|
||||
else
|
||||
_MyLog.Error("Could not set margins", ex);
|
||||
AddErrorLogInfoMarginNotFixed(myDoc, "MSWord could not set Document margins");// B2018-089 - Made error log output more useful
|
||||
//_MyLog.Error("Could not set margins", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1404,6 +1419,13 @@ namespace VEPROMS.CSLA.Library
|
||||
myDoc.PageSetup.BottomMargin = Math.Max(0, bm);
|
||||
}
|
||||
}
|
||||
private static void AddErrorLogInfoMarginNotFixed(LBDocumentClass myDoc, string msg)// B2018-089 - Made error log output more useful
|
||||
{
|
||||
_MyLog.WarnFormat("\r\n==> {0}\r\n" +
|
||||
" Document: {1}\r\n" +
|
||||
" ACTION REQUIRED: Should use Word Margins",
|
||||
msg, myDoc.FullName);
|
||||
}
|
||||
public static void CloseApp()
|
||||
{
|
||||
//WaitMS(900);// This was added because MSWord will sometimes get the error below
|
||||
|
Reference in New Issue
Block a user