Fix XY Plot offset on page if the first line of the page is centered
This commit is contained in:
parent
0936204962
commit
bdabdd1c1f
@ -871,10 +871,12 @@ namespace VEPROMS.CSLA.Library
|
|||||||
int lines = Int32.Parse(vals[2], System.Globalization.NumberStyles.AllowHexSpecifier);
|
int lines = Int32.Parse(vals[2], System.Globalization.NumberStyles.AllowHexSpecifier);
|
||||||
float height = 72 * lines / 6.0F;
|
float height = 72 * lines / 6.0F;
|
||||||
PointF pt = GetLocation(sel, adjustMargins);
|
PointF pt = GetLocation(sel, adjustMargins);
|
||||||
|
//_MyLog.WarnFormat("pt.x={0},pt.y={1}", pt.X,pt.Y);
|
||||||
float xxx = pt.X;
|
float xxx = pt.X;
|
||||||
if (xxx < 0 && xxx > -.5)
|
if (xxx < 0 && xxx > -.5)
|
||||||
xxx = 0;
|
xxx = 0;
|
||||||
float yyy = pt.Y;
|
float yyy = pt.Y;
|
||||||
|
//_MyLog.WarnFormat("xxx={0},yyy={1}", xxx, yyy);
|
||||||
sel.Text = "";
|
sel.Text = "";
|
||||||
LBShape shape = myDoc.Shapes.AddPicture(roImageFile.MyFile.FullName, xxx, yyy, sel.Range);
|
LBShape shape = myDoc.Shapes.AddPicture(roImageFile.MyFile.FullName, xxx, yyy, sel.Range);
|
||||||
File.Delete(pngFile);
|
File.Delete(pngFile);
|
||||||
@ -893,6 +895,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
shape.Height = height;
|
shape.Height = height;
|
||||||
shape.Left = xxx;
|
shape.Left = xxx;
|
||||||
shape.Top = pt.Y;
|
shape.Top = pt.Y;
|
||||||
|
//_MyLog.WarnFormat("Shape.Left={0}, Shape.Top={1}", shape.Left, shape.Top);
|
||||||
imageROTokenReplaced = true;
|
imageROTokenReplaced = true;
|
||||||
}
|
}
|
||||||
if (!imageROTokenReplaced)
|
if (!imageROTokenReplaced)
|
||||||
@ -999,6 +1002,14 @@ namespace VEPROMS.CSLA.Library
|
|||||||
LBRange rng0 = MyApp.ActiveDocument.Range(0, 0);
|
LBRange rng0 = MyApp.ActiveDocument.Range(0, 0);
|
||||||
LBRange rng1 = MyApp.ActiveDocument.Range(sel.Start, sel.Start);
|
LBRange rng1 = MyApp.ActiveDocument.Range(sel.Start, sel.Start);
|
||||||
float fx0 = adjustMargins ? (float)rng0.get_Information(LBWdInformation.wdHorizontalPositionRelativeToPage) : 0;
|
float fx0 = adjustMargins ? (float)rng0.get_Information(LBWdInformation.wdHorizontalPositionRelativeToPage) : 0;
|
||||||
|
for (int ix = sel.Start; ix > 0; ix--) // Find left most location - this was added since the first line may be centered or right justified
|
||||||
|
{
|
||||||
|
LBRange rngx = MyApp.ActiveDocument.Range(ix, ix);
|
||||||
|
float fxx = adjustMargins ? (float)rngx.get_Information(LBWdInformation.wdHorizontalPositionRelativeToPage) : 0;
|
||||||
|
//Console.WriteLine("fx0={0},fxx={1}", fx0, fxx);
|
||||||
|
if (fxx < fx0) fx0 = fxx;
|
||||||
|
else break;
|
||||||
|
}
|
||||||
float fy0 = adjustMargins ? (float)rng0.get_Information(LBWdInformation.wdVerticalPositionRelativeToPage) : 0;
|
float fy0 = adjustMargins ? (float)rng0.get_Information(LBWdInformation.wdVerticalPositionRelativeToPage) : 0;
|
||||||
float fx1 = (float)rng1.get_Information(LBWdInformation.wdHorizontalPositionRelativeToPage);
|
float fx1 = (float)rng1.get_Information(LBWdInformation.wdHorizontalPositionRelativeToPage);
|
||||||
float fy1 = (float)rng1.get_Information(LBWdInformation.wdVerticalPositionRelativeToPage);
|
float fy1 = (float)rng1.get_Information(LBWdInformation.wdVerticalPositionRelativeToPage);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user