B2019-123 When Word replaces ROs it was getting to the point where it would hang indefinitely. This only happened for Word -2019. Also, it appears that the data had to have an extra partial RO token.

This commit is contained in:
Rich 2019-08-28 19:16:06 +00:00
parent ee241103c6
commit cab40604e0

View File

@ -952,6 +952,7 @@ namespace VEPROMS.CSLA.Library
myDoc.ActiveWindow.View.ShowRevisionsAndComments = false; myDoc.ActiveWindow.View.ShowRevisionsAndComments = false;
myDoc.ActiveWindow.View.RevisionsView = LBWdRevisionsView.wdRevisionsViewFinal; myDoc.ActiveWindow.View.RevisionsView = LBWdRevisionsView.wdRevisionsViewFinal;
int lastStart = sel == null ? 0 : sel.Start; int lastStart = sel == null ? 0 : sel.Start;
while (sel != null) while (sel != null)
{ {
if (Volian.Base.Library.BaselineMetaFile.IsOpen && Volian.Base.Library.BaselineMetaFile.IncludeWordSecText) roTokenForBaseline = sel.Text; if (Volian.Base.Library.BaselineMetaFile.IsOpen && Volian.Base.Library.BaselineMetaFile.IncludeWordSecText) roTokenForBaseline = sel.Text;
@ -1690,6 +1691,8 @@ namespace VEPROMS.CSLA.Library
if (find.Execute()) return sel; if (find.Execute()) return sel;
return null; return null;
} }
// B2019-123 Verify that the RO token is the correct format
private static Regex _ROAccPageTokenPattern = new Regex("[<][^<>-]+-[^<>]+[>]");
private static LBSelection FindRO() private static LBSelection FindRO()
{ {
int firstStart = 0; int firstStart = 0;
@ -1717,8 +1720,13 @@ namespace VEPROMS.CSLA.Library
find.MatchSoundsLike = false; find.MatchSoundsLike = false;
find.MatchAllWordForms = false; find.MatchAllWordForms = false;
executeResult = find.Execute(); executeResult = find.Execute();
if (!executeResult) return null; if (!executeResult)
// MS Word found 'invalid' ro when text had "[335.0<T<335.6ºC]" (not sure what problem was). return null;
// B2019-123 Word 2019 returns true when find string was not found
// This line checks to make sure an RO was found.
if (!_ROAccPageTokenPattern.IsMatch(sel.Text))
return null;
// MS Word found 'invalid' ro when text had "[335.0<T<335.6:C]" (not sure what problem was).
// When this occurred, the selection was found, but it's end = 0, so move 1 char past it. // When this occurred, the selection was found, but it's end = 0, so move 1 char past it.
// Also, need to simulate a loop by saving first position and if loop back to first position, // Also, need to simulate a loop by saving first position and if loop back to first position,
// we are done with the search. // we are done with the search.