diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs index 043a8a1d..c48058ff 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ContentExt.cs @@ -19,23 +19,23 @@ namespace VEPROMS.CSLA.Library public void FixTransitionText(TransitionInfo tran) { string transText = tran.ResolvePathTo(); - string lookFor = string.Format(@"", tran.TranType, tran.TransitionID); + string lookFor = string.Format(@"", tran.TranType, tran.TransitionID); //string lookFor = string.Format(@"", tran.TranType, tran.TransitionID); Match m = Regex.Match(Text, lookFor); if (m != null && m.Groups.Count > 1) { - System.Text.RegularExpressions.Group g = m.Groups[1]; + System.Text.RegularExpressions.Group g = m.Groups[3]; if (g.ToString() != transText) Text = Text.Substring(0, g.Index) + transText + Text.Substring(g.Index + g.Length); } } public void FixContentText(RoUsageInfo rousg, string newvalue) { - string lookFor = string.Format(@"", rousg.ROUsageID); + string lookFor = string.Format(@"", rousg.ROUsageID); Match m = Regex.Match(Text, lookFor); if (m != null && m.Groups.Count > 1) { - System.Text.RegularExpressions.Group g = m.Groups[1]; + System.Text.RegularExpressions.Group g = m.Groups[3]; if (g.ToString() != newvalue) Text = Text.Substring(0, g.Index) + newvalue + Text.Substring(g.Index + g.Length); } diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index 15f4d0b7..e050d7b2 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -1039,9 +1039,11 @@ namespace VEPROMS.CSLA.Library retval = Regex.Replace(retval, @"\\ul ?", ""); retval = Regex.Replace(retval, @"\\i0 ?", ""); retval = Regex.Replace(retval, @"\\i ?", ""); - retval = Regex.Replace(retval, @"\\super ?", ""); - retval = Regex.Replace(retval, @"\\sub ?", ""); - retval = Regex.Replace(retval, @"\\nosupersub ?", ""); + //retval = Regex.Replace(retval, @"\\super ?", ""); + //retval = Regex.Replace(retval, @"\\sub ?", ""); + //retval = Regex.Replace(retval, @"\\nosupersub ?", ""); + retval = Regex.Replace(retval, @"\\up[30] ?", ""); + retval = Regex.Replace(retval, @"\\dn[30] ?", ""); return retval; } private static string StripLinks(string rtf) diff --git a/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs b/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs index b239d722..a8ccbb3f 100644 --- a/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs +++ b/PROMS/VEPROMS.CSLA.Library/Format/PlantFormat.cs @@ -4670,6 +4670,14 @@ namespace VEPROMS.CSLA.Library return LazyLoad(ref _UnderlineRo, "@UnderlineRo"); } } + private LazyLoad _CapFirstLetterInHighRO; + public bool CapFirstLetterInHighRO + { + get + { + return LazyLoad(ref _CapFirstLetterInHighRO, "@CapFirstLetterInHighRO"); + } + } } #endregion #endregion diff --git a/PROMS/VEPROMS/PrintMSWord/PromsPrinter.cs b/PROMS/VEPROMS/PrintMSWord/PromsPrinter.cs index 764711e0..12e5fcf7 100644 --- a/PROMS/VEPROMS/PrintMSWord/PromsPrinter.cs +++ b/PROMS/VEPROMS/PrintMSWord/PromsPrinter.cs @@ -827,18 +827,21 @@ namespace PrintMSWord string tmp = DisplayRO.ConvertFortranFormatToScienctificNotation(roValue); // Look for superscript or subscript and insert the appropriate commands - Match roMatch = Regex.Match(tmp, @"(.*?)\\(super|sub) (.*?)\\nosupersub "); + //Match roMatch = Regex.Match(tmp, @"(.*?)\\(super|sub) (.*?)\\nosupersub "); + Match roMatch = Regex.Match(tmp, @"(.*?)\\(up3|dn3) (.*?)\\(up0|dn0) "); if (roMatch.Groups.Count == 4)// Superscript or subscript found { sel.Font.Color = LBWdColor.wdColorRed; while (roMatch.Groups.Count == 4) { sel.TypeText(roMatch.Groups[1].Value); // output the text preceeding the super or sub command - sel.Font.Position = roMatch.Groups[2].Value=="super" ? 2 : -2; // Shift the vertical position for super or sub + sel.Font.Position = roMatch.Groups[2].Value == "up3" ? 2 : -2; // Shift the vertical position for super or sub + //sel.Font.Position = roMatch.Groups[2].Value == "super" ? 2 : -2; // Shift the vertical position for super or sub sel.TypeText(roMatch.Groups[3].Value); // output the superscript or subscript sel.Font.Position = 0; // restore the vertical position tmp = tmp.Substring(roMatch.Length); // remove the processed text - roMatch = Regex.Match(tmp, @"(.*?)\\(super|sub) (.*?)\\nosupersub "); // check to see if the text contain another super or sub + //roMatch = Regex.Match(tmp, @"(.*?)\\(super|sub) (.*?)\\nosupersub "); // check to see if the text contain another super or sub + roMatch = Regex.Match(tmp, @"(.*?)\\(up3|dn3) (.*?)\\(up0|dn0) "); // check to see if the text contain another super or sub } if(tmp != "")// Add any remaining text sel.TypeText(tmp); diff --git a/PROMS/VEPROMS/PrintMSWord/frmAnalyze.cs b/PROMS/VEPROMS/PrintMSWord/frmAnalyze.cs index 72f1d3ba..215e79e9 100644 --- a/PROMS/VEPROMS/PrintMSWord/frmAnalyze.cs +++ b/PROMS/VEPROMS/PrintMSWord/frmAnalyze.cs @@ -446,18 +446,21 @@ namespace PrintMSWord string tmp = DisplayRO.ConvertFortranFormatToScienctificNotation(roValue); // Look for superscript or subscript and insert the appropriate commands - Match roMatch = Regex.Match(tmp, @"(.*?)\\(super|sub) (.*?)\\nosupersub "); + //Match roMatch = Regex.Match(tmp, @"(.*?)\\(super|sub) (.*?)\\nosupersub "); + Match roMatch = Regex.Match(tmp, @"(.*?)\\(up3|dn3) (.*?)\\(up0|dn0) "); if (roMatch.Groups.Count == 4)// Superscript or subscript found { sel.Font.Color = LBWdColor.wdColorRed; while (roMatch.Groups.Count == 4) { sel.TypeText(roMatch.Groups[1].Value); // output the text preceeding the super or sub command - sel.Font.Position = roMatch.Groups[2].Value=="super" ? 2 : -2; // Shift the vertical position for super or sub + //sel.Font.Position = roMatch.Groups[2].Value=="super" ? 2 : -2; // Shift the vertical position for super or sub + sel.Font.Position = roMatch.Groups[2].Value == "up3" ? 2 : -2; // Shift the vertical position for super or sub sel.TypeText(roMatch.Groups[3].Value); // output the superscript or subscript sel.Font.Position = 0; // restore the vertical position tmp = tmp.Substring(roMatch.Length); // remove the processed text - roMatch = Regex.Match(tmp, @"(.*?)\\(super|sub) (.*?)\\nosupersub "); // check to see if the text contain another super or sub + //roMatch = Regex.Match(tmp, @"(.*?)\\(super|sub) (.*?)\\nosupersub "); // check to see if the text contain another super or sub + roMatch = Regex.Match(tmp, @"(.*?)\\(up3|dn3) (.*?)\\(up0|dn0) "); // check to see if the text contain another super or sub } if(tmp != "")// Add any remaining text sel.TypeText(tmp); @@ -540,7 +543,7 @@ namespace PrintMSWord } catch (Exception ex) { - AddInfo("Error==={0:s.ffff}==========>{1} - {2}", DateTime.Now, ex.GetType().Name, ex.Message); + AddInfo("RemovePDFFiles Error==={0:s.ffff}==========>{1} - {2}", DateTime.Now, ex.GetType().Name, ex.Message); Application.DoEvents(); } } diff --git a/PROMS/Volian.Controls.Library/DisplayRO.cs b/PROMS/Volian.Controls.Library/DisplayRO.cs index 5ff8f5c7..ec16db6a 100644 --- a/PROMS/Volian.Controls.Library/DisplayRO.cs +++ b/PROMS/Volian.Controls.Library/DisplayRO.cs @@ -783,8 +783,10 @@ namespace Volian.Controls.Library { // Convert E style numbers to RTF with \super and \nosupersub string retval = Regex.Replace(str, "([+-]?)([0-9]+)[.]([0-9]*?)0*E([+-]?[0-9]+)", new MatchEvaluator(FixFortranNumber)); - retval = Regex.Replace(retval, "[#](.*?)[#]", "\\super $1\\nosupersub ");// DOS Superscript - retval = Regex.Replace(retval, "[~](.*?)[~]", "\\sub $1\\nosupersub ");// DOS Subscript + //retval = Regex.Replace(retval, "[#](.*?)[#]", "\\super $1\\nosupersub ");// DOS Superscript + //retval = Regex.Replace(retval, "[~](.*?)[~]", "\\sub $1\\nosupersub ");// DOS Subscript + retval = Regex.Replace(retval, "[#](.*?)[#]", "\\up3 $1\\up0 ");// DOS Superscript + retval = Regex.Replace(retval, "[~](.*?)[~]", "\\dn3 $1\\dn0 ");// DOS Subscript return retval; } private static string FixFortranNumber(Match match) @@ -798,7 +800,7 @@ namespace Volian.Controls.Library else // A number with a decimal point sb.Append(match.Groups[2].Value + "." + match.Groups[3].Value + "x10"); // Add the exponent as superscript - return sb.ToString() + "\\super " + match.Groups[4].Value + "\\nosupersub "; + return sb.ToString() + "\\up3 " + match.Groups[4].Value + "\\up0 "; } //private string ConvertDOSSuperAndSubScripts(string instr) diff --git a/PROMS/Volian.Controls.Library/DisplayText.cs b/PROMS/Volian.Controls.Library/DisplayText.cs index ee4ad4a9..ff1a8a15 100644 --- a/PROMS/Volian.Controls.Library/DisplayText.cs +++ b/PROMS/Volian.Controls.Library/DisplayText.cs @@ -124,33 +124,37 @@ namespace Volian.Controls.Library (_FieldToEdit == E_FieldToEdit.StepText || _FieldToEdit == E_FieldToEdit.Text) && (!itemInfo.IsSection && !itemInfo.IsProcedure) && (itemInfo.IsTable || itemInfo.IsFigure); bool wordsShouldBeReplaced = epMode == E_EditPrintMode.Print || vwMode == E_ViewMode.View || noEdit; + if (_MyFormat == null) + Console.WriteLine(this._MyItemInfo.MyItemInfoUnique); bool numbersShouldBeFormated = (!_MyFormat.PlantFormat.FormatData.SectData.StepSectionData.FortranFormatNumbers && (epMode == E_EditPrintMode.Print || vwMode == E_ViewMode.View || noEdit)); int typ = ((int)itemInfo.MyContent.Type) % 10000; bool tableHasBorder = tableShouldBeOutlined ? itemInfo.ActiveFormat.PlantFormat.FormatData.StepDataList[typ].Type.IndexOf(@"Borderless") < 0 : false; + bool ROsShouldBeAdjusted = wordsShouldBeReplaced; // same logical value - text = CreateRtf(colorLinks, text, tableShouldBeOutlined, wordsShouldBeReplaced, numbersShouldBeFormated, tableHasBorder); + text = CreateRtf(colorLinks, text, tableShouldBeOutlined, wordsShouldBeReplaced, numbersShouldBeFormated, tableHasBorder, ROsShouldBeAdjusted); StartText = text; } public DisplayText(string text, VE_Font vFont, bool colorLinks) { TextFont = vFont; - StartText = CreateRtf(colorLinks, text, false, false, false, false); + StartText = CreateRtf(colorLinks, text, false, false, false, false, false); } - private string CreateRtf(bool colorLinks, string text, bool tableShouldBeOutlined, bool wordsShouldBeReplaced, bool numbersShouldBeFormated, bool tableHasBorder) + private string CreateRtf(bool colorLinks, string text, bool tableShouldBeOutlined, bool wordsShouldBeReplaced, bool numbersShouldBeFormated, bool tableHasBorder, bool ROsShouldBeAdjusted) { + // if in print mode, view mode, or non-active richtextbox do replace words. Only if in + // actual edit mode are replace words left as is. + if (wordsShouldBeReplaced) + text = DoReplaceWords(text); + // Adjust RO display + if (ROsShouldBeAdjusted) + text = DoROAdjustments(text); // add colors around links: if (colorLinks) - { - text = Regex.Replace(text, @"("); + MatchCollection matches = Regex.Matches(text, lookFor); + for (int i = matches.Count - 1; i >= 0; i--) + { + Match m = matches[i]; + if (m != null && m.Groups.Count > 6 && m.Groups[6].ToString() == "ReferencedObject") + { + System.Text.RegularExpressions.Group g = m.Groups[3]; + string beforeRO = StaticStripRtfCommands(text.Substring(0, g.Index)); + string afterRO = StaticStripRtfCommands(text.Substring(g.Index + g.Length)); + string newvalue = DoROFormatFlags(g.ToString(), beforeRO, afterRO); + if (g.ToString() != newvalue) + text = text.Substring(0, g.Index) + newvalue + text.Substring(g.Index + g.Length); + } } return text; } @@ -214,7 +252,8 @@ namespace Volian.Controls.Library { string fnum = m.Groups[1].Value; string supnum = m.Groups[2].Value; - string newstr = string.Format(@"{0}x10\super {1}\nosupersub ", fnum, supnum); + //string newstr = string.Format(@"{0}x10\super {1}\nosupersub ", fnum, supnum); + string newstr = string.Format(@"{0}x10\up3 {1}\up0 ", fnum, supnum); retstr = retstr.Replace(m.Value, newstr); } return retstr; @@ -294,7 +333,7 @@ namespace Volian.Controls.Library } catch (Exception ex) { - Console.WriteLine("Save Failed with error: {0}", ex.Message); + Console.WriteLine("DisplayText Save Failed with error: {0} - {1}\r\n{2}", ex.GetType().Name, ex.Message, ex.StackTrace); return false; } return true; @@ -667,18 +706,24 @@ namespace Volian.Controls.Library return token; if (Regex.IsMatch(token, @"^\\ul.*$")) return token; // Underline + if (Regex.IsMatch(token, @"^\\up[0-9] ?$")) + return token; // shift up (superscript) + break; + case 'd': + if (Regex.IsMatch(token, @"^\\dn[0-9] ?$")) + return token; // shift down (subscript) break; case '\'': // Special Character return token; case 'b': // Bold return token; - case 's': // sub or super.... - if (Regex.IsMatch(token, @"^\\sub ?$")) return token; - if (Regex.IsMatch(token, @"^\\super ?$")) return token; - break; - case 'n': // nosubsuper... - if (Regex.IsMatch(token, @"^\\nosupersub ?$")) return token; - break; + //case 's': // sub or super.... + // if (Regex.IsMatch(token, @"^\\sub ?$")) return token; + // if (Regex.IsMatch(token, @"^\\super ?$")) return token; + // break; + //case 'n': // nosubsuper... + // if (Regex.IsMatch(token, @"^\\nosupersub ?$")) return token; + // break; case 'i': // Italics return token; case '{': // look for escape for curly braces: @@ -713,7 +758,7 @@ namespace Volian.Controls.Library } catch (Exception ex) { - Console.WriteLine("{0}-{1}",ex.GetType().Name, ex.Message); + Console.WriteLine("StaticReplaceRTFClause {0} - {1}", ex.GetType().Name, ex.Message); } return "";//Strip All } @@ -776,7 +821,7 @@ namespace Volian.Controls.Library retval = retval.TrimEnd(' '); return retval; } - //public static string StaticStripRtfCommands(string rtf, ItemInfo itmInfo) + // This is used in the DataLoader public static string StaticStripRtfCommands(string rtf) { // replace \{ & \} with (![ & (!] respectively and then redo at end. The curly braces @@ -939,6 +984,131 @@ namespace Volian.Controls.Library vte.Type = (text[linkindx+16]=='R')?E_TextElementType.TransitionRange:E_TextElementType.Transition; return DoLinkElements(text, index, vte); } + + //private int GetLastLower(string stepText) + //{ + // // TO DO: need to check AlwaysUpperCase format setting - this was not yet converted as of 17Jun2010 + // // if (AlwaysUpperCase[steptype]) return (stepText.Length-1); + + // int idx = stepText.Length - 1; + // while (idx >= 0 && !(char.IsLower(stepText[idx]) && stepText[idx] != 's')) idx--; + // if (idx < 0) idx = stepText.Length - 1; // entire string is uppercased set return value to end of string + // return idx; + //} + + //private bool IsSpaceOrHardSpace(char ch) + //{ + // string spaces = @" \u160?"; + // return (spaces.IndexOf(ch) >= 0); + //} + private string DoROFormatFlags(string roText, string beforeRO, string afterRO) + { + string rtnstr = roText; + beforeRO = Regex.Replace(beforeRO, @"(\\[^v \\]+)*\\v(\\[^v \\]+)* .*?\\v0(\\[^v \\]+)*( |$)", ""); + afterRO = Regex.Replace(afterRO, @"(\\[^v \\]+)*\\v(\\[^v \\]+)* .*?\\v0(\\[^v \\]+)*( |$)", ""); + + // Underline all ROs, values and Units + if (_MyItemInfo.ActiveFormat.PlantFormat.FormatData.ROData.UnderlineRo) + { + // TO DO: Need to check if step text is already underlined + rtnstr = @"\ul " + rtnstr + @"\ulnone "; + } + + // UpcaseAllRoUnits - Uppercases ALL ROs units everywhere. + if (_MyItemInfo.ActiveFormat.PlantFormat.FormatData.ROData.UpcaseAllRoUnits) + return UpperCaseUnits(rtnstr); + + //Forces the units for a RO to be uppercased for high level steps + if (_MyItemInfo.ActiveFormat.PlantFormat.FormatData.ROData.CapHighRo &&_MyItemInfo.IsHigh) + return UpperCaseUnits(rtnstr); + + // Caps ROs anywhere if no lower case text follows + // and an upper case letter immediately precedes the RO. + if (_MyItemInfo.ActiveFormat.PlantFormat.FormatData.ROData.CapRoIfLastLower && Regex.IsMatch(afterRO,".*[a-z].*") && char.IsUpper(LastAlpha(beforeRO))) + { + //int indx = startLinkText - 1; + //int indx2 = endLinkText + 1; + //while (indx > 0 && !IsSpaceOrHardSpace(stepText[indx])) indx--; // find character before RO + //while (indx2 <= stepText.Length && !IsSpaceOrHardSpace(stepText[indx2])) indx2++; // find character after RO + + //if (indx >= 0 && char.IsUpper(stepText[indx]) && indx2 > GetLastLower(stepText)) + // doUpCase = true; + return UpperCaseUnits(rtnstr); + } + + // If a RO follows a "- " then it will be uppercased + if (_MyItemInfo.ActiveFormat.PlantFormat.FormatData.ROData.UpRoAftrDash && Regex.IsMatch(beforeRO, @".*\\u8209\?( |\\u160\?)$")) + { + //int indx = startLinkText - 1; + //while (indx > 0 && !IsSpaceOrHardSpace(stepText[indx])) indx--; // find character before RO + //string prefix = indx >= 7?stepText.Substring(indx-7,8):""; + //doUpCase = (prefix == @"\u8209? "); // Dash character before RO + return UpperCaseUnits(rtnstr); + } + + // Uppercase the RO Unit if the previous letter is uppercase + if (_MyItemInfo.ActiveFormat.PlantFormat.FormatData.ROData.UpRoIfPrevUpper && char.IsUpper(LastAlpha(beforeRO))) + { + //doUpCase = (char.IsUpper(stepText[startLinkText - 1])); + return UpperCaseUnits(rtnstr); + + } + + //CapFirstLetterInHighRO - Cap only the first letters of the units in a high level RO + // note: used in FLP (Turkey Point) format + if (_MyItemInfo.ActiveFormat.PlantFormat.FormatData.ROData.CapFirstLetterInHighRO && _MyItemInfo.IsHigh) + { + int idx = 0; + string tstr = ""; + while (idx < rtnstr.Length && !char.IsLetter(rtnstr[idx])) tstr += rtnstr[idx++].ToString(); + if (idx < rtnstr.Length) + { + tstr += char.ToUpper(rtnstr[idx]).ToString(); + if (idx + 1 < rtnstr.Length) + tstr += rtnstr.Substring(idx + 1); + } + rtnstr = tstr; + } + + //In a sequence of RO values, the unit appears with every value + //(e.g., "25 gpm and 30 gpm" vs. "25 and 30 gpm") + //if (!_MyItemInfo.ActiveFormat.PlantFormat.FormatData.ROData.AllUnits) + //{ + // int idx = rtnstr.LastIndexOf(' '); + // if (idx > 0) + // { + // StringBuilder sb = new StringBuilder(); + // string lastunit = rtnstr.Substring(idx); // RO unit including preceeding space + // int idx2 = rtnstr.IndexOf(lastunit); + // int si = 0; + // while (idx2 < idx) + // { + // sb.Append(rtnstr.Substring(si, idx2 - si)); + // si = idx2 + lastunit.Length; + // idx2 = rtnstr.IndexOf(lastunit, si); + // } + // sb.Append(rtnstr.Substring(si)); + // rtnstr = sb.ToString(); + // } + //} + + return rtnstr; + } + + private string UpperCaseUnits(string rtnstr) + { + // After converting the value to uppercase, change X10 to x10 to handle Fortran Formatted numbers + return rtnstr.ToUpper().Replace("X10", "x10"); + } + + // Find the last Alphabetical character + private char LastAlpha(string beforeRO) + { + Match m = Regex.Match(beforeRO, ".*([a-zA-Z])[^a-zA-Z]*"); + if (m.Success) return m.Groups[1].ToString()[0]; + return '\0'; + } + private int DoLinkElements(string text, int index, displayLinkElement vte) { // Find the 'end comment' for the 0 && (endTextIndx < 0 || endTextIndx > endTextIndx2)) + endTextIndx = endTextIndx2; vte.Text = text.Substring(endStartTknIndx + 4, endTextIndx - endStartTknIndx - 4); // 4 for \v0 // Now get the link part. It can be terminated by a '\v0' or an [END> @@ -962,7 +1135,12 @@ namespace Volian.Controls.Library tmptxt = FixTransition(vte.Link, vte.Text); vte.Text = tmptxt; } - + //else + //{ + // tmptxt = DoROFormatFlags(vte.Text, text, index, endLinkIndx); + // vte.Text = tmptxt; + //} + // Now get the entire text & link. Account for various ending possibilities: // ends with '\v0\'; ends with '\v0 '; ends with '\v0' (end of string); // ends with '[END>' if two in a row - will have "); - return m.Groups[1].ToString(); + Match m = Regex.Match(_TextAndLink, @""); + return m.Groups[3].ToString(); } return _Text; } @@ -1153,8 +1331,8 @@ namespace Volian.Controls.Library { if (_TextAndLink != null) { - Match m = Regex.Match(_TextAndLink, @""); - System.Text.RegularExpressions.Group g = m.Groups[1]; + Match m = Regex.Match(_TextAndLink, @""); + System.Text.RegularExpressions.Group g = m.Groups[3]; _TextAndLink = _TextAndLink.Substring(0, g.Index) + value + _TextAndLink.Substring(g.Index + g.Length); } _Text = value; diff --git a/PROMS/Volian.Controls.Library/LinkText.cs b/PROMS/Volian.Controls.Library/LinkText.cs index e926b3b1..dfb95759 100644 --- a/PROMS/Volian.Controls.Library/LinkText.cs +++ b/PROMS/Volian.Controls.Library/LinkText.cs @@ -17,7 +17,9 @@ namespace Volian.Controls.Library { if (_LinkInfoText == null) return; // First parse the string - _LinkInfoText = _LinkInfoText.Replace(@"\v ", ""); + if (_LinkInfoText.Contains(@"\v")) + throw new Exception("LinkText.ParseLink found RTF token"); + //_LinkInfoText = _LinkInfoText.Replace(@"\v ", ""); // this is not needed because this is selected Text does not contain RTF tokens // for tran : "2, #, #, # and 4#Link:TransitionRange:2 10 173 166" Match m = Regex.Match(_LinkInfoText, @"(.*)[#]Link:([A-Za-z]*):(.*)"); _MyValue = m.Groups[1].Value;