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

@ -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<T<335.6ºC]" (not sure what problem was).
if (!executeResult)
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.
// Also, need to simulate a loop by saving first position and if loop back to first position,
// we are done with the search.