From cab40604e0beeead45c360f175dd6f62dd81f65b Mon Sep 17 00:00:00 2001 From: Rich Date: Wed, 28 Aug 2019 19:16:06 +0000 Subject: [PATCH] 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. --- .../Extension/DocumentExt.cs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs index 30b25f8a..29edb2f4 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs @@ -725,7 +725,7 @@ namespace VEPROMS.CSLA.Library public static bool UpdateDocPdf(DocumentInfo mydoc, Color overrideColor, ItemInfo sect) { MSWordToPDF.OverrideColor = overrideColor; - PdfInfo myPdf = PdfInfo.Get(sect,DocReplace!=null); + PdfInfo myPdf = PdfInfo.Get(sect, DocReplace != null); MSWordToPDF.OverrideColor = Color.Black; // B2019-090 reset to black text (when a Complete RO Report was created after printing procedure, X/Y Plot was in red text) return true; } @@ -766,7 +766,7 @@ namespace VEPROMS.CSLA.Library } else { - using (Pdf myPdf1 = Pdf.MakePdf(doc, ss*10 + MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopMargin, (int)myDocStyle.Layout.PageLength, + using (Pdf myPdf1 = Pdf.MakePdf(doc, ss * 10 + MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopMargin, (int)myDocStyle.Layout.PageLength, (int)myDocStyle.Layout.LeftMargin, (int)myDocStyle.Layout.PageWidth, (double)sect.MSWordPageCount, buf)) { ;} } doc.UpdateDRoUsages(roids); @@ -810,7 +810,7 @@ namespace VEPROMS.CSLA.Library } // string AccPageID = string.Format("<{0}-{1}>", accPrefix, roch.appid); // B2017-249 Recover Temporary File And AutoSave support for MSWord - using (DSOFile myFile = new DSOFile(sect.MyContent.MyEntry.MyDocument,true)) + using (DSOFile myFile = new DSOFile(sect.MyContent.MyEntry.MyDocument, true)) { // Increase the priority of the Word Process so that the pdf creation happens quickly Process[] myProcessess = Process.GetProcessesByName("winword"); @@ -952,6 +952,7 @@ namespace VEPROMS.CSLA.Library myDoc.ActiveWindow.View.ShowRevisionsAndComments = false; myDoc.ActiveWindow.View.RevisionsView = LBWdRevisionsView.wdRevisionsViewFinal; int lastStart = sel == null ? 0 : sel.Start; + while (sel != null) { 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; return null; } + // B2019-123 Verify that the RO token is the correct format + private static Regex _ROAccPageTokenPattern = new Regex("[<][^<>-]+-[^<>]+[>]"); private static LBSelection FindRO() { int firstStart = 0; @@ -1717,8 +1720,13 @@ namespace VEPROMS.CSLA.Library find.MatchSoundsLike = false; find.MatchAllWordForms = false; executeResult = find.Execute(); - if (!executeResult) return null; - // MS Word found 'invalid' ro when text had "[335.0