Printer.PrintableRect 属性 (Publisher)
返回一个 PrintableRect 对象,该对象代表指定打印机打印的打印机工作表区域。 此为只读属性。
语法
表达式。PrintableRect
表达 一个代表 Printer 对象的变量。
返回值
PrintableRect
备注
可打印矩形由打印机根据指定的纸型确定。 不应将打印机纸张的可打印矩形与出版物页面边距以内的区域相混淆。 可打印矩形可能大于或小于出版物页面。
注意
在打印机纸张与出版物页面大小相等的情况下,出版物页面在打印机纸张上居中,并且不打印任何打印机标记(即使已将其选中)。
示例
下面的 Microsoft Visual Basic for Applications (VBA) 宏显示如何使用 PrintableRect 属性来获取当前打印机的打印机纸张的可打印矩形边界。
Public Sub PrintableRect_Example()
Dim pubInstalledPrinters As Publisher.InstalledPrinters
Dim pubApplication As Publisher.Application
Dim pubPrinter As Publisher.Printer
Set pubApplication = ThisDocument.Application
Set pubInstalledPrinters = pubApplication.InstalledPrinters
For Each pubPrinter In pubInstalledPrinters
If pubPrinter.IsActivePrinter Then
With pubPrinter.PrintableRect
Debug.Print "Printable area is " & PointsToInches(.Width) & " by " & PointsToInches(.Height) & " inches."
Debug.Print "Left Boundary: " & PointsToInches(.Left) & " inches (from left)."
Debug.Print "Right Boundary: " & PointsToInches(.Left + .Width) & " inches (from left)."
Debug.Print "Top Boundary: " & PointsToInches(.Top) & " inches(from top)."
Debug.Print "Bottom Boundary: " & PointsToInches(.Top + .Height) & " inches (from top)."
End With
End If
Next
End Sub
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。
反馈
https://aka.ms/ContentUserFeedback。
即将发布:在整个 2024 年,我们将逐步淘汰作为内容反馈机制的“GitHub 问题”,并将其取代为新的反馈系统。 有关详细信息,请参阅:提交和查看相关反馈