B2017-264 Limit Right Margin and Bottom Margin so that they cannot be negative.This was causing a problem when a Landscape section was added.

This commit is contained in:
Rich 2017-11-29 15:35:48 +00:00
parent e7da0639da
commit 92eb33c044

View File

@ -1382,15 +1382,19 @@ namespace VEPROMS.CSLA.Library
else
{
myDoc.PageSetup.TopMargin = 0;
myDoc.PageSetup.LeftMargin = 0;
myDoc.PageSetup.RightMargin = (8.5F * 72) - newWidth + newLeft;
myDoc.PageSetup.LeftMargin = 0;// B2017-264 Limit the value for right margin so that it cannot be negative.
float rm = (8.5F * 72) - newWidth + newLeft;
myDoc.PageSetup.RightMargin = Math.Max(0,rm);
// For OHLP, docstyle (ohlpdoc.in) in 16-bit for "Cover Page", pagelen seems to be incorrect. It would
// put out text on a second page. The following code is to catch this condition and reset the bottom margin.
// 11 * 72 -> 11 inches converted to points. newLength is printable part so BottomMargin is unprintable part
float bm;
if (newTop + 36 > ((11 * 72) - newLength)) // 36 is 1/2 inch
myDoc.PageSetup.BottomMargin = newTop + 36; // makes an 1/2 inch bottom margin
bm = newTop + 36; // makes an 1/2 inch bottom margin
else
myDoc.PageSetup.BottomMargin = (11 * 72) - newLength;
bm = (11 * 72) - newLength;
// B2017-264 Limit the value for bottom margin so that it cannot be negative
myDoc.PageSetup.BottomMargin = Math.Max(0, bm);
}
}
public static void CloseApp()