Calculating absolute position with openXML

Viewed 421

i am trying to define the absolute position of my image and i assing a value like this:

DW.HorizontalPosition horizontalPosition1 = new DW.HorizontalPosition() {
    RelativeFrom = DW.HorizontalRelativePositionValues.Column 
};
DW.PositionOffset positionOffset1 = new DW.PositionOffset();
positionOffset1.Text = "-715645";

i do the same for vertical position, but this time i pass a value that should be the same value that is in a word document like 1.5, or 2.7 to absolute position.

public static class MathOpenXml
{
    public const int ONEEMUINCENTIMETERS = 360000;

    public static double? centimetersToEMU(double? cm)
    {
        return (cm * ONEEMUINCENTIMETERS);
    }
}

and then instead of the hardcoded value i have this:

DW.VerticalPosition verticalPosition1 = new DW.VerticalPosition() {
    RelativeFrom = DW.VerticalRelativePositionValues.Paragraph
};
DW.PositionOffset positionOffset2 = new DW.PositionOffset();
positionOffset2.Text = MathOpenXml.centimetersToEMU(verticalPosition).ToString();

the thing is that the value is not the same, i pass 0.24 in verticalPosition, and i get a 0.9, they are close but not the same, some help please :/

thanks

0 Answers
Related