From a33347b22a2c047eda395ba63a559ea34807c649 Mon Sep 17 00:00:00 2001 From: Kathy Date: Mon, 18 Aug 2014 13:34:09 +0000 Subject: [PATCH] Replace words for bolding [Bxxx], i.e. support for regular expression text in replaceword/with Added TextAt counter for debug Added debug of TextAt by allowing specifying of ItemIds --- PROMS/Volian.Controls.Library/DisplayText.cs | 14 ++++++++++-- PROMS/Volian.Print.Library/PromsPrinter.cs | 1 + PROMS/Volian.Print.Library/Rtf2Pdf.cs | 23 +++++++++++++++++++- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/PROMS/Volian.Controls.Library/DisplayText.cs b/PROMS/Volian.Controls.Library/DisplayText.cs index 0ad7600a..59fbd10d 100644 --- a/PROMS/Volian.Controls.Library/DisplayText.cs +++ b/PROMS/Volian.Controls.Library/DisplayText.cs @@ -1644,8 +1644,10 @@ namespace Volian.Controls.Library // ReplaceStrData xml node is empty, it does the inheritance and gets the 'base' format's list. if (rsl.Count==1 && (rsl[0].ReplaceWord == null || rsl[0].ReplaceWord == "")) return Text; // Loop through text looking for words to be replaced + List partialReplaceList = new List(); foreach (ReplaceStr rs in rsl) { + bool dopartial = false; bool replaceit = false; // note that the order of this check is important. Check in this order... // background here @@ -1662,6 +1664,11 @@ namespace Volian.Controls.Library { if (!dicReplaceRegex.ContainsKey(rs)) { + if ((rs.Flag & E_ReplaceFlags.Partials) == E_ReplaceFlags.Partials) + { + partialReplaceList.Add(rs); + dopartial = true; + } // CASEINSENS: Do ReplaceWords for all words that match, regardless of case, and replace with the ReplaceWith string as is //RegexOptions myOptions = (rs.Flag & E_ReplaceFlags.CaseInsens) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase & RegexOptions.Singleline : RegexOptions.None & RegexOptions.Singleline; RegexOptions myOptions = (rs.Flag & E_ReplaceFlags.CaseInsens) == E_ReplaceFlags.CaseInsens ? RegexOptions.IgnoreCase: RegexOptions.None; @@ -1671,20 +1678,23 @@ namespace Volian.Controls.Library string wordMatchBeg = Regex.IsMatch(replaceWord.Substring(0, 1), @"\W") ? "" : @"(?<=\W|^)"; string wordMatchEnd = Regex.IsMatch(replaceWord.Substring(replaceWord.Length - 1, 1), @"\W") ? "" : @"(?=\W|$)"; string pat = wordMatchBeg + @"(?