C2018-023 added a “/NW” switch for use with the automated print testing (batch file) to turn off the inclusion of Word attachment text in the metafile

This commit is contained in:
John Jenko 2018-08-02 13:10:40 +00:00
parent 601b4edfb7
commit 63932cd2c9
3 changed files with 26 additions and 14 deletions

View File

@ -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
}

View File

@ -776,7 +776,7 @@ namespace VEPROMS.CSLA.Library
public static string ToPDFReplaceROs(DocumentInfo doc, List<string> 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("<<G"); // find the starting Plot Command
// B2017-217 Added logic so that underscores are not converted to underline
@ -1072,13 +1072,13 @@ namespace VEPROMS.CSLA.Library
shape.Left = xxx;
shape.Top = pt.Y;
sel.WholeStory();
if (Volian.Base.Library.BaselineMetaFile.IsOpen) Volian.Base.Library.BaselineMetaFile.WriteLine("{0}", TextForBaseline.FixText(txtForBaseline,true));
if (Volian.Base.Library.BaselineMetaFile.IsOpen && Volian.Base.Library.BaselineMetaFile.IncludeWordSecText) Volian.Base.Library.BaselineMetaFile.WriteLine("{0}", TextForBaseline.FixText(txtForBaseline, true));
}
catch (Exception ex)
{
// something is wrong with the X/Y plot RO.
// print out the un-processed X/Y plot RO value
if (Volian.Base.Library.BaselineMetaFile.IsOpen) txtForBaseline = txtForBaseline.Replace(roTokenForBaseline, string.Format("BAD XYPLOT: {0}", val));
if (Volian.Base.Library.BaselineMetaFile.IsOpen && Volian.Base.Library.BaselineMetaFile.IncludeWordSecText) txtForBaseline = txtForBaseline.Replace(roTokenForBaseline, string.Format("BAD XYPLOT: {0}", val));
sel.Text = val;
//return null;
}
@ -1093,7 +1093,7 @@ namespace VEPROMS.CSLA.Library
//AddInfo("\tRO Found {0} = '{1}'", sel.Text, val);
// if val is null, then InsertROValue will put in "RO Not Found" for the value
float indent = (float)sel.get_Information(LBWdInformation.wdHorizontalPositionRelativeToTextBoundary);
if (Volian.Base.Library.BaselineMetaFile.IsOpen) txtForBaseline = txtForBaseline.Replace(roTokenForBaseline, val);
if (Volian.Base.Library.BaselineMetaFile.IsOpen && Volian.Base.Library.BaselineMetaFile.IncludeWordSecText) txtForBaseline = txtForBaseline.Replace(roTokenForBaseline, val);
// B2017-217 Added logic so that underscores are not converted to underline
InsertROValue(sel, val, sect.ActiveFormat.PlantFormat.FormatData.ROData.UpRoIfPrevUpper, indent, sect.MyActiveSection.ActiveFormat.PlantFormat.FormatData.SectData.ConvertUnderscoreToUnderline);
}
@ -1107,7 +1107,7 @@ namespace VEPROMS.CSLA.Library
if (statusChange != null) statusChange(VolianStatusType.Update, 0, "Creating PDF");
sel = MyApp.Selection;
sel.WholeStory();
if (Volian.Base.Library.BaselineMetaFile.IsOpen) Volian.Base.Library.BaselineMetaFile.WriteLine("{0}", TextForBaseline.FixText(txtForBaseline,true));
if (Volian.Base.Library.BaselineMetaFile.IsOpen && Volian.Base.Library.BaselineMetaFile.IncludeWordSecText) Volian.Base.Library.BaselineMetaFile.WriteLine("{0}", TextForBaseline.FixText(txtForBaseline, true));
//sel.Range.Font.Color = (LBWdColor)WordColor(PrintOverride.OverrideTextColor(System.Drawing.Color.Black));
//Console.WriteLine("'{0}' Colors Sel '{1}' Override '{2}' Transparent '{3}' Black '{4}' Red '{5}'", sect.DisplayNumber, sel.Range.Font.Color, OverrideColor, System.Drawing.Color.Transparent, System.Drawing.Color.Black, System.Drawing.Color.Red);
if(sel.Range.Font.Color != (LBWdColor)9999999 || OverrideColor == System.Drawing.Color.Red)// B2017-144 If the font color is 9999999 then the color is mixed, and if the override color isn't red, don't change the color.
@ -1127,7 +1127,7 @@ namespace VEPROMS.CSLA.Library
CloseAppAfterWait();
}
if (statusChange != null) statusChange(VolianStatusType.Complete, 0, "");
if (Volian.Base.Library.BaselineMetaFile.IsOpen) Volian.Base.Library.BaselineMetaFile.WriteLine("++EndTxt++");
if (Volian.Base.Library.BaselineMetaFile.IsOpen && Volian.Base.Library.BaselineMetaFile.IncludeWordSecText) Volian.Base.Library.BaselineMetaFile.WriteLine("++EndTxt++");
GC.Collect(); //jsj 2-15-2016 - for memeory garbage collection
return fileName;
}

View File

@ -160,5 +160,11 @@ namespace Volian.Base.Library
{ _MyDebugPrint.Show(); }
public static bool IsOpen
{ get { return _MyDebugPrint.IsOpen; } }
private static bool _IncludeWordSecText = true;
public static bool IncludeWordSecText
{
get { return BaselineMetaFile._IncludeWordSecText; }
set { BaselineMetaFile._IncludeWordSecText = value; }
}
}
}