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:
Rich
2018-06-11 14:29:57 +00:00
parent be7d9da0f0
commit 4d20d8219b
2 changed files with 39 additions and 11 deletions

View File

@@ -534,7 +534,8 @@ namespace VEPROMS.CSLA.Library
}
private string DoROAdjustments(string text)
{
Regex regRefObj = new Regex(@"\#Link\:ReferencedObject:([0-9]*|<NewID>) ([0-9a-zA-Z]*) ([0-9]*)", RegexOptions.Singleline);
// B2018-088 - Added code to look for CROUSGID
Regex regRefObj = new Regex(@"\#Link\:ReferencedObject:([0-9]*|<NewID>|<CROUSGID=-?[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("<NEWID>"))
_MyLog.WarnFormat("Unprocessed RO in {0},({1})",_MyItemInfo.ShortPath,gg);
// B-2018-088 Made Error Log output more useful
if (m.ToString().ToUpper().Contains("<NEWID>") || m.ToString().ToUpper().Contains("<CROUSGID="))
_MyLog.WarnFormat("\r\n==> 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);