From 944868a0b46203498c189d25343e27974b191b70 Mon Sep 17 00:00:00 2001 From: Rich Date: Mon, 13 May 2013 10:41:52 +0000 Subject: [PATCH] Changed an Error Message to provide the location where the error occured. Changed StepLevel property for Cautions and Notes to reduce the probability that notes or cautions will be split over a page break. Added IsNumbered Property to aid in pagination. --- .../Extension/DocumentExt.cs | 10 +++++++- .../VEPROMS.CSLA.Library/Extension/ItemExt.cs | 25 ++++++++++++++----- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs index b50ea6ca..885533eb 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs @@ -505,8 +505,10 @@ namespace VEPROMS.CSLA.Library get { return MSWordToPDF._FormForPlotGraphics; } set { MSWordToPDF._FormForPlotGraphics = value; } } + private static SectionInfo _MySection; public static string GetDocPdf(SectionInfo sect, Color overrideColor) { + _MySection = sect; DocumentInfo mydoc = sect.MyContent.MyEntry.MyDocument; UpdateDocPdf(mydoc, overrideColor,sect); string fileName = GetFileName(sect); @@ -884,7 +886,13 @@ namespace VEPROMS.CSLA.Library } catch (Exception ex) { - _MyLog.Error("Could not set margins", ex); + if (_MySection != null) + { + _MyLog.ErrorFormat("<<< ERROR >>> MSWord could not set margins\r\n==>'MSWord could not set margins',{0},'{1}','{2}'" + , _MySection.ItemID, _MySection.MyDocVersion.MyFolder.Name, _MySection.ShortPath); + } + else + _MyLog.Error("Could not set margins", ex); } } } diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs index dc9c6a91..a3453375 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/ItemExt.cs @@ -677,14 +677,14 @@ namespace VEPROMS.CSLA.Library else if (item.IsCautionPart) { if (item.MyPrevious == null) level-=(1 + firstInc); - else level++; + else level+=3; } // Paginate before first note, if the step does not have a caution. // Otherwise, try to keep the notes together. else if (item.IsNotePart) { if (parent.Cautions == null && item.MyPrevious == null) level-=(1 + firstInc); - else level++; + else level+=3; } // Try not to paginate on a table. else if (item.IsTablePart) @@ -1103,6 +1103,19 @@ namespace VEPROMS.CSLA.Library return false; } } + public bool IsNumbered + { + get + { + if ((MyContent.Type / 10000) != 2) return true; + string tabstr = FormatStepData.TabData.IdentPrint; + if (tabstr.Contains("{seq}")) return true; + if (tabstr.Contains("{ALPHA}")) return true; + if (tabstr.Contains("{ROMAN}")) return true; + if (tabstr.Contains("{numeric}")) return true; + return false; + } + } public bool IsTablePart { get @@ -2395,7 +2408,7 @@ namespace VEPROMS.CSLA.Library _MyTab.Text = ""; _MyTab.CleanText = ""; return; - } + } int stepType = (int)(MyContent.Type % 10000); string tbformat = IsInRNO ? FormatStepData.TabData.RNOIdentPrint : FormatStepData.TabData.IdentPrint; if (ActiveFormat.Name.ToUpper() == "WCNCKL" || ActiveFormat.Name.ToUpper() == "WSTCKL") @@ -2718,9 +2731,9 @@ namespace VEPROMS.CSLA.Library { SectionConfig sc = new SectionConfig(si); //SectionConfig sc = ii.MyConfig as SectionConfig; - if (sc != null && sc.SubSection_AutoIndent == "Y") - countlev++; - } + if (sc != null && sc.SubSection_AutoIndent == "Y") + countlev++; + } } ii = ii.MyParent; }