C2018-017 Put description of all know symbol characters in the baseline meta file

C2018-018 Put the contents of the Word sections in the baseline meta file
This commit is contained in:
2018-08-01 15:05:22 +00:00
parent 8f180f14d2
commit 7a0edda568
2 changed files with 332 additions and 5 deletions

View File

@@ -776,6 +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);
return ToPDFReplaceROs(sect, false, roids, statusChange);
}
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
@@ -845,7 +846,12 @@ namespace VEPROMS.CSLA.Library
AddErrorLogInfoMarginNotFixed(sect,"Word section could not adjust margins"); // B2018-089 - Made error log output more useful
//_MyLog.Error("Could not Adjust Margins", ex);
}
LBSelection selxy = hasRos ? FindXyPlot() : null;
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++");
LBSelection sel = MyApp.Selection;
sel.WholeStory();
if (Volian.Base.Library.BaselineMetaFile.IsOpen) 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);
int filecount = 1;
@@ -855,9 +861,21 @@ namespace VEPROMS.CSLA.Library
string xyplot = selxy.Text;
xyplot = xyplot.Replace("`", "\xB0");
xyplot = xyplot.Replace("\xF8", "\xB0");
if (Volian.Base.Library.BaselineMetaFile.IsOpen)
{
txtForBaseline = txtForBaseline.Replace("`", "\xB0");
txtForBaseline = txtForBaseline.Replace("\xF8", "\xB0");
}
if (convertCaretToDeltaSymbol)
{
xyplot = xyplot.Replace("^", "\x394"); // delta
xyplot = xyplot.Replace("\x7F", "\x394"); //delta
xyplot = xyplot.Replace("\x7F", "\x394"); //delta
if (Volian.Base.Library.BaselineMetaFile.IsOpen)
{
txtForBaseline = txtForBaseline.Replace("^", "\x394");
txtForBaseline = txtForBaseline.Replace("\x7F", "\x394");
}
}
// The 16bit code must have kept the carriage returns in the word doc, if there
// are carriage returns in the plot language. Count number of carriage return/newlines
// so that they can be added back.
@@ -914,8 +932,9 @@ namespace VEPROMS.CSLA.Library
selxy.WholeStory();
selxy = FindXyPlot();
}
LBSelection sel = MyApp.Selection;
//LBSelection sel = MyApp.Selection;
sel.WholeStory();
string roTokenForBaseline = "";
if (statusChange != null) statusChange(VolianStatusType.Initialize, sel.End, "Refreshing ROs");
sel = hasRos ? FindRO() : null;
int roCount = 0;
@@ -925,6 +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 (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);
@@ -995,10 +1015,14 @@ 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]));
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);
}
}
else if ((int)type == 4) // X-Y Plot
{
@@ -1010,6 +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);
// 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
@@ -1017,7 +1042,7 @@ namespace VEPROMS.CSLA.Library
val = val.Substring(pstart); // set val to the start of the plot commands
pngFile = VlnSettings.TemporaryFolder + @"\XYPlot1.png"; //@"C:\Temp\XYPlot1.png";
RectangleF plotRect = CreatePlot(pngFile, val, 600F, FormForPlotGraphics);
PointF pt = GetLocation(sel,adjustMargins);
PointF pt = GetLocation(sel, adjustMargins);
float xxx = pt.X + plotRect.X;
if (xxx < 0 && xxx > -.5)
xxx = 0;
@@ -1047,11 +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));
}
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));
sel.Text = val;
//return null;
}
@@ -1066,6 +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);
// 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);
}
@@ -1079,6 +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));
//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.
@@ -1098,6 +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++");
GC.Collect(); //jsj 2-15-2016 - for memeory garbage collection
return fileName;
}