diff --git a/PROMS/Volian.Controls.Library/DisplayText.cs b/PROMS/Volian.Controls.Library/DisplayText.cs index d2593a24..5db7e1e2 100644 --- a/PROMS/Volian.Controls.Library/DisplayText.cs +++ b/PROMS/Volian.Controls.Library/DisplayText.cs @@ -1003,14 +1003,10 @@ namespace Volian.Controls.Library case '}': return token; case 'v': // save link hidden info - if (Regex.IsMatch(token, @"^\\v0? ?$")) return token; // comment part of link - // end comment may end in space or may end in '\' if another rtf command, - // or may end at end of string. First check for space, keep it in string - // if it is there. - //if (Regex.IsMatch(token, @"\\v0 ")) - // return token; - //if (Regex.IsMatch(token, @"\\v0")) - // return token; + if (token == "\\viewkind4 ") break; + if (Regex.IsMatch(token, @"^\\v0? ?$")) + return token; // comment part of link + _MyLog.WarnFormat("<<>>\r\n==> Token including Comment not processed '{0}'", token); break; case 'l': if (Regex.IsMatch(token, @"^\\line ?$")) return token; @@ -1038,12 +1034,13 @@ namespace Volian.Controls.Library { // replace \{ & \} with (![ & (!] respectively and then redo at end. The curly braces // are rtf so were getting removed and/or not handled correctly. - string retval = rtf.Replace(@"\{", @"(!["); - retval = retval.Replace(@"\}", @"(!]"); + string retval = rtf.Replace(@"\{", @" (!["); + retval = retval.Replace(@"\}", @" (!]"); // remove carriage return/newlines after \par commands (these are introduced by rtb // for hard returns, goes into rtb as \par and comes out as \par\r\n): retval = Regex.Replace(retval, @"\\par\r\n(?!\\)", "\\par "); + retval = retval.Replace("\\v0\r\n", "\\v0 "); // Replace Carriage Return and Newline after comment retval = Regex.Replace(retval, @"[\r\n]", "", RegexOptions.Singleline); // Strip Carriage Returns and Newlines retval = Regex.Replace(retval, @"^\{(.*)\}$", "$1", RegexOptions.Singleline); // Strip Opening and Closing Braces retval = Regex.Replace(retval, @"\{[^{]*?\}", "", RegexOptions.Singleline); // Strip Clauses - remove anything from curly braces @@ -1057,8 +1054,8 @@ namespace Volian.Controls.Library if (retval.Length == 0) return ""; if (retval.EndsWith(@"\v")) retval = retval.Remove(retval.Length - 2, 2); retval = _MyItemInfo.RemoveRtfStyles(retval); // RemoveRtfStyles(retval); - retval = retval.Replace(@"(![", @"\{"); - retval = retval.Replace(@"(!]", @"\}"); + retval = retval.Replace(@" (![", @"\{"); + retval = retval.Replace(@" (!]", @"\}"); retval = retval.TrimEnd(' '); return retval; } @@ -1067,8 +1064,8 @@ namespace Volian.Controls.Library { // replace \{ & \} with (![ & (!] respectively and then redo at end. The curly braces // are rtf so were getting removed and/or not handled correctly. - string retval = rtf.Replace(@"\{", @"(!["); - retval = retval.Replace(@"\}", @"(!]"); + string retval = rtf.Replace(@"\{", @" (!["); + retval = retval.Replace(@"\}", @" (!]"); // For hardspaces, the windows richtextbox does some 'quirky' things: // A unicode representation of \u160? is sent INTO the rtb. Coming out, @@ -1083,6 +1080,7 @@ namespace Volian.Controls.Library retval = Regex.Replace(retval, @"\\par\r\n(?!\\)", "\\par "); //retval = Regex.Replace(retval, @"\\par\r\n(?=\\)", "\\par"); + retval = retval.Replace("\\v0\r\n", "\\v0 "); // Replace Carriage Return and Newline after comment retval = Regex.Replace(retval, @"[\r\n]", "", RegexOptions.Singleline); // Strip Carriage Returns and Newlines retval = Regex.Replace(retval, @"^\{(.*)\}$", "$1", RegexOptions.Singleline); // Strip Opening and Closing Braces retval = Regex.Replace(retval, @"\{[^{]*?\}", "", RegexOptions.Singleline); // Strip Clauses - remove anything from curly braces @@ -1117,8 +1115,8 @@ namespace Volian.Controls.Library //if (itmInfo != null) // retval = StaticRemoveRtfStyles(retval, itmInfo); - retval = retval.Replace(@"(![", @"\{"); - retval = retval.Replace(@"(!]", @"\}"); + retval = retval.Replace(@" (![", @"\{"); + retval = retval.Replace(@" (!]", @"\}"); retval = retval.TrimEnd(' '); // the indent character was translated in the richtextbox, change it back: