diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs b/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs index 228b66e3..8510291b 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/DisplayText.cs @@ -534,7 +534,8 @@ namespace VEPROMS.CSLA.Library } private string DoROAdjustments(string text) { - Regex regRefObj = new Regex(@"\#Link\:ReferencedObject:([0-9]*|) ([0-9a-zA-Z]*) ([0-9]*)", RegexOptions.Singleline); + // B2018-088 - Added code to look for CROUSGID + Regex regRefObj = new Regex(@"\#Link\:ReferencedObject:([0-9]*||) ([0-9a-zA-Z]*) ([0-9]*)", RegexOptions.Singleline); string strippedText = StaticStripRtfCommands(text); // (\\[^v \\]+)* --> look for any rtf commands (first part of lookFor) // \\v0 --> end of comment @@ -565,13 +566,18 @@ namespace VEPROMS.CSLA.Library myIndex = m.Groups[3].Index; myLength += m.Groups[3].Length; } - string gg = text.Substring(myIndex, myLength); + string gg = text.Substring(myIndex, myLength).TrimEnd(" ".ToCharArray());// RHM 20180608 - Found an issue where the value contained a trailing space //System.Text.RegularExpressions.Group g = m.Groups[3]; string beforeRO = StaticStripRtfCommands(text.Substring(0, myIndex)); string afterRO = StaticStripRtfCommands(text.Substring(myIndex + myLength)); Match myMatch = regRefObj.Match(m.ToString()); - if(m.ToString().ToUpper().Contains("")) - _MyLog.WarnFormat("Unprocessed RO in {0},({1})",_MyItemInfo.ShortPath,gg); + // B-2018-088 Made Error Log output more useful + if (m.ToString().ToUpper().Contains("") || m.ToString().ToUpper().Contains(" Unprocessed RO in [{0}] {1} with a value of {2} \r\n" + + " in {3}\r\n" + + " ACTION REQUIRED: Step should be relinked (Deleted, Retyped and Linked)", + _MyItemInfo.ItemID, _MyItemInfo.ShortPath,gg.Replace("\\u8209?","-"), + _MyItemInfo.SearchDVPath.Replace("\a","/")); int dbid = System.Convert.ToInt32(myMatch.Groups[2].Value.Substring(0, 4), 16); int rodbid = int.Parse(myMatch.Groups[3].Value); ROFstInfo myROFst = _MyItemInfo.MyDocVersion.GetROFst(rodbid); diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs index 3a5c2958..efa82702 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs @@ -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