diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs index d8429af0..707d2806 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/TransitionExt.cs @@ -374,6 +374,7 @@ namespace VEPROMS.CSLA.Library _AppendMethods.Add("{Proc Title}", AddTransitionProcTitle); _AppendMethods.Add("{?.Proc Title}", AddOptionalTransitionProcTitle); _AppendMethods.Add("{First Step}", AddStepNumber); + _AppendMethods.Add("{Step Number}", AddStepNumber); // WCN2, tran type 6 _AppendMethods.Add("{Last Step}", AddRangeStepNumber); _AppendMethods.Add("{.}", AddIncludedStepNumber); _AppendMethods.Add("{Sect Hdr}", AddTranGetSectionHdr); @@ -382,6 +383,8 @@ namespace VEPROMS.CSLA.Library _AppendMethods.Add("{?.Sect Title}", AddOptionalTranGetSectionTitle); _AppendMethods.Add("{?.Sect Num}", AddOptionalTranGetSectionNum); _AppendMethods.Add("{Sect Num}", AddTranGetSectionNumber); + _AppendMethods.Add("{Sect Number}", AddTranGetSectionNumber); // WCN2, tran type 6 + } public static string GetResolvedText(ItemInfo fromInfo, int tranType, ItemInfo toItem, ItemInfo rangeItem) { @@ -595,15 +598,18 @@ namespace VEPROMS.CSLA.Library pitem = pitem.ActiveParent as ItemInfo; if (pitem == null) break; } - // add hls tab. + // add hls tab if it's not already in the tab. if (pitem.IsHigh) { string hlsTab = StepInfo.Get(pitem.ItemID).MyTab.CleanTextNoSymbols; - if (!hasDelim) - foreach (string rmvDelim in DelimList) hlsTab = hlsTab.Replace(rmvDelim, ""); - hlsTab = hlsTab.Trim(" ".ToCharArray()); - if (hasDelim && !hlsTab.EndsWith(".") && !hlsTab.EndsWith(")")) hlsTab = hlsTab + "."; - sret = hlsTab + sret; + if (!sret.StartsWith(hlsTab.Trim(" ".ToCharArray()))) + { + if (!hasDelim) + foreach (string rmvDelim in DelimList) hlsTab = hlsTab.Replace(rmvDelim, ""); + hlsTab = hlsTab.Trim(" ".ToCharArray()); + if (hasDelim && !hlsTab.EndsWith(".") && !hlsTab.EndsWith(")")) hlsTab = hlsTab + "."; + sret = hlsTab + sret; + } } break; } diff --git a/PROMS/Volian.Controls.Library/DisplayText.cs b/PROMS/Volian.Controls.Library/DisplayText.cs index 6f79e8b2..ae9df4ab 100644 --- a/PROMS/Volian.Controls.Library/DisplayText.cs +++ b/PROMS/Volian.Controls.Library/DisplayText.cs @@ -381,6 +381,8 @@ namespace Volian.Controls.Library string strippedText = StaticStripRtfCommands(text); string lookFor = string.Format(@""); MatchCollection matches = Regex.Matches(text, lookFor); + if (matches.Count == 0) return text; + string retstr = null; for (int i = matches.Count - 1; i >= 0; i--) { Match m = matches[i]; @@ -398,16 +400,17 @@ namespace Volian.Controls.Library string newvalue = g.ToString(); int indexLastSpace = newvalue.LastIndexOf(' '); if (indexLastSpace >= 0) - text = beforeTran + newvalue.Substring(0, indexLastSpace) + @"\u160?" + newvalue.Substring(indexLastSpace + 1) + afterTran; + retstr = beforeTran + newvalue.Substring(0, indexLastSpace) + @"\u160?" + newvalue.Substring(indexLastSpace + 1) + afterTran; else if (beforeTran.EndsWith(" ") ) - text = ReplaceLastSpaceWithHardSpace(beforeTran) + newvalue + afterTran; + retstr = ReplaceLastSpaceWithHardSpace(beforeTran) + newvalue + afterTran; else Console.Write("");// Don't know where to put the Hard Space } } } - return text; + if (retstr == null) return text; // no transition processing occurred, just return original string. + return retstr; } private string ReplaceLastSpaceWithHardSpace(string str) {