diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs index 1851c21d..118eebf8 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs @@ -526,6 +526,9 @@ namespace VEPROMS.CSLA.Library //ItemInfo sect = doc.DocumentEntries[0].MyContent.ContentItems[0]; return ToPDFReplaceROs(sect, false, roids); } + + private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); + public static string ToPDFReplaceROs(ItemInfo sect, bool openPdf, List roids) //, System.Drawing.Color overrideColor, System.Windows.Forms.Form myForm) { string fileName = GetFileName(sect); @@ -574,7 +577,14 @@ namespace VEPROMS.CSLA.Library } } LBDocumentClass myDoc = MyApp.Documents.Open(myFile.FullName, false); - AdjustMargins(myDocStyle, myDoc, true); + try + { + AdjustMargins(myDocStyle, myDoc, true); + } + catch (Exception ex) + { + _MyLog.Error("Could not Adjust Margins",ex); + } LBSelection selxy = hasRos ? FindXyPlot() : null; while (selxy != null) { @@ -733,10 +743,13 @@ namespace VEPROMS.CSLA.Library //Console.WriteLine("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}", newTop, newLeft, newLength, newWidth, oldTop, oldLeft, oldBottom, oldRight,oldHeight,oldWidth); if (printingMode) { - myDoc.PageSetup.BottomMargin = 0;// 11 * 72 - (newTop + newLength); - myDoc.PageSetup.RightMargin = newRight; - myDoc.PageSetup.LeftMargin = newLeft; - myDoc.PageSetup.TopMargin = newTop; + if (myDoc.PageSetup.BottomMargin != 9999999) + { + myDoc.PageSetup.BottomMargin = 0; // 11 * 72 - (newTop + newLength); + myDoc.PageSetup.RightMargin = newRight; + myDoc.PageSetup.LeftMargin = newLeft; + myDoc.PageSetup.TopMargin = newTop; + } } else { diff --git a/PROMS/Volian.Controls.Library/DSOTabPanel.cs b/PROMS/Volian.Controls.Library/DSOTabPanel.cs index 0dde99d1..bef50d45 100644 --- a/PROMS/Volian.Controls.Library/DSOTabPanel.cs +++ b/PROMS/Volian.Controls.Library/DSOTabPanel.cs @@ -324,7 +324,11 @@ namespace Volian.Controls.Library return; } LBDocumentClass doc = new LBDocumentClass(_MyDSOFramer.ActiveDocument); - MyDSOFile.FullName = GetReflectiveProperty(_MyDSOFramer.ActiveDocument, "FullName"); + string tmp = GetReflectiveProperty(_MyDSOFramer.ActiveDocument, "FullName"); + if (System.IO.File.Exists(tmp)) + MyDSOFile.FullName = tmp; + else + _MyLog.FatalFormat("File does not exist {0}\r\nFile was {1}", tmp, MyDSOFile.FullName); // if this was a library document, ask user if it should be saved for all usages. bool cvtLibDoc = false; EntryInfo myei = MyDisplayTabItem.MyItemInfo.MyContent.MyEntry;