我正在尝试定义我的图像的绝对位置,我正在给出这样的值:
DW.HorizontalPosition horizontalPosition1 = new DW.HorizontalPosition() {
RelativeFrom = DW.HorizontalRelativePositionValues.Column
};
DW.PositionOffset positionOffset1 = new DW.PositionOffset();
positionOffset1.Text = "-715645";
我对垂直位置做同样的事情,但是这次我传递的值应该与单词文档中的值相同,如1.5或2.7到绝对位置。
public static class MathOpenXml
{
public const int ONEEMUINCENTIMETERS = 360000;
public static double? centimetersToEMU(double? cm)
{
return (cm * ONEEMUINCENTIMETERS);
}
}
然后代替硬编码的值我有这个:
DW.VerticalPosition verticalPosition1 = new DW.VerticalPosition() {
RelativeFrom = DW.VerticalRelativePositionValues.Paragraph
};
DW.PositionOffset positionOffset2 = new DW.PositionOffset();
positionOffset2.Text = MathOpenXml.centimetersToEMU(verticalPosition).ToString();
事情是价值不一样,我在verticalPosition中传递0.24,我得到0.9,他们接近但不一样,有些帮助请:/
感谢