diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs index 2231f2b9..6ce347a0 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs @@ -1761,7 +1761,25 @@ namespace VEPROMS.CSLA.Library find.MatchWildcards = true; find.MatchSoundsLike = false; find.MatchAllWordForms = false; - executeResult = find.Execute(); + // B2022-053 in a Barakah word attachment (ST procedure set procedure DG-5204) the RO tokens are not resolved after a certain + // point in a table. + // Turns out this happens when a table cell had text that begins with a "<" and it does not end with a ">" and there is no + // space or other word following that text in the table cell. For example, there was a table cell who's text + // was "<90" cause the Word Find command to return an entire table row which cause PROMS to stop processing + // the rest of the Word attachment section. + bool tryagain = false; + do + { + tryagain = false; + executeResult = find.Execute(); + // B2022-053 if the found text does not begin with a "<" and end with a ">", then + // move past that text and try the Word Find function again. + if (executeResult && !sel.Text.StartsWith("<") && !sel.Text.EndsWith(">")) + { + sel.MoveStart(LBWdUnits.wdCharacter, sel.Text.Length-1); + tryagain = true; + } + } while (tryagain); if (!executeResult) return null; // B2019-123 Word 2019 returns true when find string was not found