This commit is contained in:
parent
6afde922e3
commit
5dc4b9f861
@ -292,7 +292,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
cfg.Printing_Length = length;
|
cfg.Printing_Length = length;
|
||||||
cfg.Printing_Color = MSWordToPDF.OverrideColor;
|
cfg.Printing_Color = MSWordToPDF.OverrideColor;
|
||||||
doc.Config = cfg.ToString();
|
doc.Config = cfg.ToString();
|
||||||
doc.UserID = Environment.UserName;
|
doc.UserID = Volian.Base.Library.VlnSettings.UserID;
|
||||||
doc.DTS = _MyFile.LastWriteTime;
|
doc.DTS = _MyFile.LastWriteTime;
|
||||||
doc.Save();
|
doc.Save();
|
||||||
string pdfTmp = MSWordToPDF.ToPDFReplaceROs(_MyDocument);
|
string pdfTmp = MSWordToPDF.ToPDFReplaceROs(_MyDocument);
|
||||||
@ -445,24 +445,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
LBDocumentClass myDoc = MyApp.Documents.Open(myFile.FullName, false);
|
LBDocumentClass myDoc = MyApp.Documents.Open(myFile.FullName, false);
|
||||||
float newTop = (float)myDocStyle.Layout.TopRow;
|
AdjustMargins(myDocStyle, myDoc, true);
|
||||||
float newLeft = (float)myDocStyle.Layout.LeftMargin;
|
|
||||||
float newLength = (float)myDocStyle.Layout.PageLength;
|
|
||||||
float newWidth = (float)myDocStyle.Layout.PageWidth;
|
|
||||||
float oldTop = myDoc.PageSetup.TopMargin;
|
|
||||||
float oldLeft = myDoc.PageSetup.LeftMargin;
|
|
||||||
float oldBottom = myDoc.PageSetup.BottomMargin;
|
|
||||||
float oldRight = myDoc.PageSetup.RightMargin;
|
|
||||||
float oldHeight = myDoc.PageSetup.PageHeight;
|
|
||||||
float oldWidth = myDoc.PageSetup.PageWidth;
|
|
||||||
float newRight = oldWidth - (newWidth + newLeft);
|
|
||||||
if (newRight < 0) newRight = 0;
|
|
||||||
float newBottom = oldBottom - newTop;
|
|
||||||
//Console.WriteLine("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9}", newTop, newLeft, newLength, newWidth, oldTop, oldLeft, oldBottom, oldRight,oldHeight,oldWidth);
|
|
||||||
myDoc.PageSetup.BottomMargin = 0;// 11 * 72 - (newTop + newLength);
|
|
||||||
myDoc.PageSetup.RightMargin = newRight;
|
|
||||||
myDoc.PageSetup.LeftMargin = newLeft;
|
|
||||||
myDoc.PageSetup.TopMargin = newTop;
|
|
||||||
LBSelection sel = FindRO();
|
LBSelection sel = FindRO();
|
||||||
while (sel != null)
|
while (sel != null)
|
||||||
{
|
{
|
||||||
@ -562,6 +545,44 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void AdjustMargins(DocStyle myDocStyle, LBDocumentClass myDoc, bool printingMode)
|
||||||
|
{
|
||||||
|
float newTop = (float)myDocStyle.Layout.TopRow;
|
||||||
|
float newLeft = (float)myDocStyle.Layout.LeftMargin;
|
||||||
|
float newLength = (float)myDocStyle.Layout.PageLength;
|
||||||
|
float newWidth = (float)myDocStyle.Layout.PageWidth;
|
||||||
|
float oldTop = myDoc.PageSetup.TopMargin;
|
||||||
|
float oldLeft = myDoc.PageSetup.LeftMargin;
|
||||||
|
float oldBottom = myDoc.PageSetup.BottomMargin;
|
||||||
|
float oldRight = myDoc.PageSetup.RightMargin;
|
||||||
|
float oldHeight = myDoc.PageSetup.PageHeight;
|
||||||
|
float oldWidth = myDoc.PageSetup.PageWidth;
|
||||||
|
float newRight = oldWidth - (newWidth + newLeft);
|
||||||
|
if (newRight < 0) newRight = 0;
|
||||||
|
float newBottom = oldBottom - newTop;
|
||||||
|
//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;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
myDoc.PageSetup.TopMargin = 0;
|
||||||
|
myDoc.PageSetup.LeftMargin = 0;
|
||||||
|
myDoc.PageSetup.RightMargin = (8.5F * 72) - newWidth + newLeft;
|
||||||
|
// 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
|
||||||
|
if (newTop + 36 > ((11 * 72) - newLength)) // 36 is 1/2 inch
|
||||||
|
myDoc.PageSetup.BottomMargin = newTop + 36; // makes an 1/2 inch bottom margin
|
||||||
|
else
|
||||||
|
myDoc.PageSetup.BottomMargin = (11 * 72) - newLength;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void CloseApp()
|
public static void CloseApp()
|
||||||
{
|
{
|
||||||
WaitMS(300);// This was added because MSWord will sometimes get the error below
|
WaitMS(300);// This was added because MSWord will sometimes get the error below
|
||||||
|
Loading…
x
Reference in New Issue
Block a user