diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs index dd6cd2eb..b7f8c32b 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/DocumentExt.cs @@ -404,8 +404,16 @@ namespace VEPROMS.CSLA.Library pdfFile.Delete(); Pdf.DeleteAll(doc.DocID); // clear the PDF table for DocID first DocStyle myDocStyle = myItemInfo.ActiveSection.MyDocStyle; - using (Pdf myPdf = Pdf.MakePdf(doc, MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopMargin, (int)myDocStyle.Layout.PageLength, - (int)myDocStyle.Layout.LeftMargin, (int)myDocStyle.Layout.PageWidth, (double)myItemInfo.MSWordPageCount, buf)) { ;} + SectionConfig sc = myItemInfo.ActiveSection.MyConfig as SectionConfig; + if (sc != null && sc.Section_WordMargin == "Y") + { + using (Pdf myPdf = Pdf.MakePdf(doc, MSWordToPDF.DebugStatus, 0, 0, 0, 0, (double)myItemInfo.MSWordPageCount, buf)) { ;} + } + else + { + using (Pdf myPdf = Pdf.MakePdf(doc, MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopMargin, (int)myDocStyle.Layout.PageLength, + (int)myDocStyle.Layout.LeftMargin, (int)myDocStyle.Layout.PageWidth, (double)myItemInfo.MSWordPageCount, buf)) { ;} + } doc.UpdateDRoUsages(roids); doc.Save(); } @@ -514,8 +522,16 @@ namespace VEPROMS.CSLA.Library using (Document doc = docInfo.Get()) { DocStyle myDocStyle = sect.ActiveSection.MyDocStyle; - using (Pdf myPdf = Pdf.MakePdf(doc, MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopMargin, (int)myDocStyle.Layout.PageLength, + SectionConfig sc = sect.ActiveSection.MyConfig as SectionConfig; + if (sc != null && sc.Section_WordMargin == "Y") + { + using (Pdf myPdf = Pdf.MakePdf(doc, MSWordToPDF.DebugStatus, 0, 0, 0, 0, (double)sect.MSWordPageCount, buf)) { ;} + } + else + { + using (Pdf myPdf1 = Pdf.MakePdf(doc, MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopMargin, (int)myDocStyle.Layout.PageLength, (int)myDocStyle.Layout.LeftMargin, (int)myDocStyle.Layout.PageWidth, (double)sect.MSWordPageCount, buf)) { ;} + } doc.UpdateDRoUsages(roids); doc.Save(); } @@ -578,11 +594,15 @@ namespace VEPROMS.CSLA.Library LBDocumentClass myDoc = MyApp.Documents.Open(myFile.FullName, false); try { - AdjustMargins(myDocStyle, myDoc, true); + SectionConfig sc = sect.ActiveSection.MyConfig as SectionConfig; + if (sc == null || sc.Section_WordMargin == "N") + { + AdjustMargins(myDocStyle, myDoc, true); + } } catch (Exception ex) { - _MyLog.Error("Could not Adjust Margins",ex); + _MyLog.Error("Could not Adjust Margins", ex); } LBSelection selxy = hasRos ? FindXyPlot() : null; while (selxy != null) diff --git a/PROMS/VEPROMS.CSLA.Library/Extension/PdfExt.cs b/PROMS/VEPROMS.CSLA.Library/Extension/PdfExt.cs index df78c487..fa55342d 100644 --- a/PROMS/VEPROMS.CSLA.Library/Extension/PdfExt.cs +++ b/PROMS/VEPROMS.CSLA.Library/Extension/PdfExt.cs @@ -69,8 +69,17 @@ namespace VEPROMS.CSLA.Library while (count < 2) { DocStyle myDocStyle = sect.ActiveSection.MyDocStyle; - PdfInfo myPdf = Get(sect.MyContent.MyEntry.DocID, MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopMargin, (int)myDocStyle.Layout.PageLength, - (int)myDocStyle.Layout.LeftMargin, (int)myDocStyle.Layout.PageWidth); + SectionConfig sc = sect.ActiveSection.MyConfig as SectionConfig; + PdfInfo myPdf = null; + if (sc != null && sc.Section_WordMargin == "Y") + { + myPdf = Get(sect.MyContent.MyEntry.DocID, MSWordToPDF.DebugStatus, 0, 0, 0, 0); + } + else + { + myPdf = Get(sect.MyContent.MyEntry.DocID, MSWordToPDF.DebugStatus, (int)myDocStyle.Layout.TopMargin, (int)myDocStyle.Layout.PageLength, + (int)myDocStyle.Layout.LeftMargin, (int)myDocStyle.Layout.PageWidth); + } if (myPdf != null) return myPdf; if (count > 0) return null; // Could not find or create a pdf MSWordToPDF.SetDocPdf(sect.MyContent.MyEntry.MyDocument, sect);