From 63932cd2c97dd4e7a6080a61148edab1a2daa7ab Mon Sep 17 00:00:00 2001 From: John Date: Thu, 2 Aug 2018 13:10:40 +0000 Subject: [PATCH] =?UTF-8?q?C2018-023=20added=20a=20=E2=80=9C/NW=E2=80=9D?= =?UTF-8?q?=20switch=20for=20use=20with=20the=20automated=20print=20testin?= =?UTF-8?q?g=20(batch=20file)=20to=20turn=20off=20the=20inclusion=20of=20W?= =?UTF-8?q?ord=20attachment=20text=20in=20the=20metafile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DlgPrintProcedure.cs | 6 ++++ .../Extension/DocumentExt.cs | 28 +++++++++---------- PROMS/Volian.Base.Library/DebugPrint.cs | 6 ++++ 3 files changed, 26 insertions(+), 14 deletions(-) diff --git a/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs b/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs index 601d069b..3a0af99b 100644 --- a/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs +++ b/PROMS/VEPROMS User Interface/DlgPrintProcedure.cs @@ -49,11 +49,13 @@ namespace VEPROMS get { return _Automatic; } set { _Automatic = value; } } + private bool _IncludeWordSecTextInMetafile = true; // C2018-023 so that we can turn off including Word attachment text in metafile private void RunAutomatic() { cbxDebugPagination.Checked = true; cbxDebugText.Checked = true; cbxMetaFile.Checked = true; // C2018-004 create meta file for baseline compares + _IncludeWordSecTextInMetafile = true; Application.DoEvents(); string[] parameters = System.Environment.CommandLine.Split(" ".ToCharArray()); bool ranAuto = false; @@ -67,6 +69,8 @@ namespace VEPROMS cbxDebug.Checked = false; else if (parameter.ToUpper() == "/NM") cbxMetaFile.Checked = false; // C2018-004 turn off create meta file for baseline compares + else if (parameter.ToUpper() == "/NW") + _IncludeWordSecTextInMetafile = false; // C2018-023 turn off putting Word attachment text in the meta file for baseline compares } CreatePDFs(); this.Close(); @@ -676,6 +680,8 @@ namespace VEPROMS Volian.Base.Library.BaselineMetaFile.Open(PDFPath + "\\DebugMeta.txt"); // C2018-015 add the PROMS Version, SQL Server, and Database to top of the meta file Volian.Base.Library.BaselineMetaFile.WriteLine("!! Ver {0} {1} {2}", AboutVEPROMS.PROMSVersion, AboutVEPROMS.SQLServerName, AboutVEPROMS.DatabaseName); + // C2018-023 set as to whether we are going to include the Word attment text in the baseline metafile + Volian.Base.Library.BaselineMetaFile.IncludeWordSecText = _IncludeWordSecTextInMetafile; } Rtf2Pdf._lastPageNum = 0; // reset page number } diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs index 82197b94..d066560e 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs @@ -776,7 +776,7 @@ namespace VEPROMS.CSLA.Library public static string ToPDFReplaceROs(DocumentInfo doc, List roids, ItemInfo sect, VolianStatusChange statusChange) { //ItemInfo sect = doc.DocumentEntries[0].MyContent.ContentItems[0]; - if (Volian.Base.Library.BaselineMetaFile.IsOpen) Volian.Base.Library.BaselineMetaFile.WriteLine("WrdSec SecNum=\"{0}\" SecTitle=\"{1}\" Itemid={2}", sect.MyActiveSection.DisplayNumber, sect.MyActiveSection.DisplayText, sect.ItemID); + if (Volian.Base.Library.BaselineMetaFile.IsOpen && Volian.Base.Library.BaselineMetaFile.IncludeWordSecText) Volian.Base.Library.BaselineMetaFile.WriteLine("WrdSec SecNum=\"{0}\" SecTitle=\"{1}\" Itemid={2}", sect.MyActiveSection.DisplayNumber, sect.MyActiveSection.DisplayText, sect.ItemID); return ToPDFReplaceROs(sect, false, roids, statusChange); } private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); @@ -847,10 +847,10 @@ namespace VEPROMS.CSLA.Library //_MyLog.Error("Could not Adjust Margins", ex); } string txtForBaseline = ""; // C2018-018 save the contents of Word sections - after resolving RO values - if (Volian.Base.Library.BaselineMetaFile.IsOpen) Volian.Base.Library.BaselineMetaFile.WriteLine("++BgnTxt++"); + if (Volian.Base.Library.BaselineMetaFile.IsOpen && Volian.Base.Library.BaselineMetaFile.IncludeWordSecText) Volian.Base.Library.BaselineMetaFile.WriteLine("++BgnTxt++"); LBSelection sel = MyApp.Selection; sel.WholeStory(); - if (Volian.Base.Library.BaselineMetaFile.IsOpen) txtForBaseline = sel.Text; + if (Volian.Base.Library.BaselineMetaFile.IsOpen && Volian.Base.Library.BaselineMetaFile.IncludeWordSecText) txtForBaseline = sel.Text; LBSelection selxy = hasRos ? FindXyPlot() : null; // look for XY Plot language typed into word section (not an RO) string pngFile = VlnSettings.TemporaryFolder + @"\XYPlot1.png"; //@"C:\Temp\XYPlot1.png"; if (File.Exists(pngFile)) File.Delete(pngFile); @@ -861,7 +861,7 @@ namespace VEPROMS.CSLA.Library string xyplot = selxy.Text; xyplot = xyplot.Replace("`", "\xB0"); xyplot = xyplot.Replace("\xF8", "\xB0"); - if (Volian.Base.Library.BaselineMetaFile.IsOpen) + if (Volian.Base.Library.BaselineMetaFile.IsOpen && Volian.Base.Library.BaselineMetaFile.IncludeWordSecText) { txtForBaseline = txtForBaseline.Replace("`", "\xB0"); txtForBaseline = txtForBaseline.Replace("\xF8", "\xB0"); @@ -870,7 +870,7 @@ namespace VEPROMS.CSLA.Library { xyplot = xyplot.Replace("^", "\x394"); // delta xyplot = xyplot.Replace("\x7F", "\x394"); //delta - if (Volian.Base.Library.BaselineMetaFile.IsOpen) + if (Volian.Base.Library.BaselineMetaFile.IsOpen && Volian.Base.Library.BaselineMetaFile.IncludeWordSecText) { txtForBaseline = txtForBaseline.Replace("^", "\x394"); txtForBaseline = txtForBaseline.Replace("\x7F", "\x394"); @@ -944,7 +944,7 @@ namespace VEPROMS.CSLA.Library int lastStart = sel == null ? 0 : sel.Start; while (sel != null) { - if (Volian.Base.Library.BaselineMetaFile.IsOpen) roTokenForBaseline = sel.Text; + if (Volian.Base.Library.BaselineMetaFile.IsOpen && Volian.Base.Library.BaselineMetaFile.IncludeWordSecText) roTokenForBaseline = sel.Text; if (statusChange != null) statusChange(VolianStatusType.Update, sel.Start, string.Format("{0} ROs Refreshed", ++roCount)); string val = lookup.GetROValueByAccPagID(sel.Text, spPrefix, igPrefix); int? type = lookup.GetROTypeByAccPagID(sel.Text, spPrefix, igPrefix); @@ -1015,13 +1015,13 @@ namespace VEPROMS.CSLA.Library shape.Left = xxx; shape.Top = pt.Y; //_MyLog.WarnFormat("Shape.Left={0}, Shape.Top={1}", shape.Left, shape.Top); - if (Volian.Base.Library.BaselineMetaFile.IsOpen) txtForBaseline = txtForBaseline.Replace(roTokenForBaseline, string.Format("[{0}]", vals[0])); + if (Volian.Base.Library.BaselineMetaFile.IsOpen && Volian.Base.Library.BaselineMetaFile.IncludeWordSecText) txtForBaseline = txtForBaseline.Replace(roTokenForBaseline, string.Format("[{0}]", vals[0])); imageROTokenReplaced = true; } if (!imageROTokenReplaced) { sel.Text = string.Format("Bad Image Link (Missing Image File:{0})", vals[0]); - if (Volian.Base.Library.BaselineMetaFile.IsOpen) txtForBaseline = txtForBaseline.Replace(roTokenForBaseline, sel.Text); + if (Volian.Base.Library.BaselineMetaFile.IsOpen && Volian.Base.Library.BaselineMetaFile.IncludeWordSecText) txtForBaseline = txtForBaseline.Replace(roTokenForBaseline, sel.Text); } } else if ((int)type == 4) // X-Y Plot @@ -1034,7 +1034,7 @@ namespace VEPROMS.CSLA.Library if (convertCaretToDeltaSymbol) val = val.Replace("^", "\x394"); // delta val = val.Replace("\x7F", "\x394"); //delta - if (Volian.Base.Library.BaselineMetaFile.IsOpen) txtForBaseline = txtForBaseline.Replace(sel.Text, val); + if (Volian.Base.Library.BaselineMetaFile.IsOpen && Volian.Base.Library.BaselineMetaFile.IncludeWordSecText) txtForBaseline = txtForBaseline.Replace(sel.Text, val); // An X/Y Plot RO type might have text preceding the Plot Commands int pstart = val.IndexOf("<