Don't set LPI; set top margin based on data (not = 0) and determine x/y of xyplot BEFORE reset of selection (various WCN plant specific bugs).

This commit is contained in:
Kathy Ruffing 2012-07-03 15:57:44 +00:00
parent 2876f37d2f
commit 0cf5331132

View File

@ -622,17 +622,18 @@ namespace VEPROMS.CSLA.Library
// Setting the selected text to "" actually sets it to "\r", thus cnt-- (subtract one
// from cnt since there's already a return in the string.
cnt--;
selxy.Text = "";
if (cnt>0)for (int icnt = 0; icnt < cnt; icnt++) selxy.Text = selxy.Text + "\r";
string pngFile = VlnSettings.TemporaryFolder + @"\XYPlot1.png"; //@"C:\Temp\XYPlot1.png";
RectangleF plotRect = CreatePlot(pngFile, xyplot, 600F, FormForPlotGraphics);
//LBShape shape = myDoc.Shapes.AddPicture(@"C:\Temp\XYPlot.png", 0, 0, sel.Range);
float x = (float)selxy.get_Information(LBWdInformation.wdHorizontalPositionRelativeToPage);
float y = (float)selxy.get_Information(LBWdInformation.wdVerticalPositionRelativeToPage);
LBRange myRange = selxy.Paragraphs.First.Range;
float yTop = (float)myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToPage);
float yTop1 = (float)myRange.get_Information(LBWdInformation.wdVerticalPositionRelativeToTextBoundary);
selxy.Text = "";
if (cnt>0)for (int icnt = 0; icnt < cnt; icnt++) selxy.Text = selxy.Text + "\r";
string pngFile = VlnSettings.TemporaryFolder + @"\XYPlot1.png"; //@"C:\Temp\XYPlot1.png";
RectangleF plotRect = CreatePlot(pngFile, xyplot, 600F, FormForPlotGraphics);
float xAdjust = (float)-sect.MyDocStyle.Layout.LeftMargin;
float yAdjust = selxy.Font.Size;
LBShape shape = myDoc.Shapes.AddPicture(pngFile, x + xAdjust + plotRect.X, yAdjust + y - yTop + plotRect.Y, selxy.Range);
@ -746,8 +747,6 @@ namespace VEPROMS.CSLA.Library
sel.WholeStory();
//sel.Range.Font.Color = (LBWdColor)WordColor(PrintOverride.OverrideTextColor(System.Drawing.Color.Black));
sel.Range.Font.Color = (LBWdColor)WordColor(OverrideColor == System.Drawing.Color.Transparent ? System.Drawing.Color.Black : OverrideColor);
sel.ParagraphFormat.LineSpacingRule = LBWdLineSpacing.wdLineSpaceExactly;
sel.ParagraphFormat.LineSpacing = 12;
sect.MSWordPageCount = myDoc.Length;
fileName = CreatePDF(fileName, openPdf);
MyApp.ActiveDocument.Close(false);
@ -779,7 +778,8 @@ namespace VEPROMS.CSLA.Library
{
if (myDoc.PageSetup.BottomMargin != 9999999)
{
myDoc.PageSetup.BottomMargin = 0; // 11 * 72 - (newTop + newLength);
// the + 1 in the next line allows for rounding.
myDoc.PageSetup.BottomMargin = 11 * 72 - (newTop + newLength + 1);
myDoc.PageSetup.RightMargin = newRight;
myDoc.PageSetup.LeftMargin = newLeft;
myDoc.PageSetup.TopMargin = newTop;
@ -788,7 +788,8 @@ namespace VEPROMS.CSLA.Library
{
try
{
myDoc.PageSetup.BottomMargin = 0; // 11 * 72 - (newTop + newLength);
// the + 1 in the next line allows for rounding.
myDoc.PageSetup.BottomMargin = 11 * 72 - (newTop + newLength + 1);
myDoc.PageSetup.RightMargin = newRight;
myDoc.PageSetup.LeftMargin = newLeft;
myDoc.PageSetup.TopMargin = newTop;