WPS 基础接口 > 文字 API 参考 > PageSetup > 属性 > PageSetup.TopMargin 属性
返回或设置页面的上边缘与正文文本的上边界之间的距离(以磅为单位)。可读写 Single 类型。

语法

表达式.TopMargin

表达式   必选。一个代表 PageSetup 对象的变量。

示例

以下示例将活动文档中第一节的上边距设置为 72 磅(1 英寸)。

示例代码
ActiveDocument.Sections.Item(1).PageSetup.TopMargin = 72

以下示例创建一个新的自定义标签,并设置包括上边距在内的部分属性,然后使用自定义标签创建一个新文档。

示例代码
let newlbl = Application.MailingLabel.CustomLabels.Add("My Label")
newlbl.Height = InchesToPoints(1.25)
newlbl.NumberAcross = 2
newlbl.NumberDown = 7
newlbl.PageSize = wdCustomLabelLetter
newlbl.SideMargin = InchesToPoints(0)
newlbl.TopMargin = InchesToPoints(1)
newlbl.Width = InchesToPoints(4.25)
Application.MailingLabel.CreateNewDocument("My Label")


请参阅