需要使用OOXML设置Word文档中图像的相对位置

时间:2018-09-28 12:44:16

标签: c# openxml

我正在使用OOXML创建word文档。在页脚中,我需要显示图像。我能够画出图像。在运行时绘制图像时,我正在设置一些属性。以下是相同的代码。

 string haPosition = impPosition;
        if (string.IsNullOrEmpty(haPosition))
        {
            haPosition = "left";
        }
        // Define the reference of the image.
        DW.Anchor anchor = new DW.Anchor();

        anchor.Append(new DW.SimplePosition() { X = 0L, Y = 0L });


        anchor.Append(
            new DW.HorizontalPosition(
                new DW.HorizontalAlignment(haPosition)

            )
            {
                RelativeFrom =  DW.HorizontalRelativePositionValues.Page,
            }
        );
        anchor.Append(

            new DW.VerticalPosition(                  
                new DW.PositionOffset("0")

            )
            {
                //RelativeFrom =  DW.VerticalRelativePositionValues.BottomMargin,
                RelativeFrom = DW.VerticalRelativePositionValues.BottomMargin

            }
        );

我想将水平和垂直位置的相对位置值都设置为5% pls check the image

0 个答案:

没有答案
相关问题