Report.PrtMip 属性 (Access)
使用 Visual Basic 中的 PrtMip 属性可在“ 打印 ”对话框中设置或返回为窗体或报表指定的设备模式信息。
语法
表达式。PrtMip
表达 一个代表 Report 对象的变量。
备注
PrtMip 属性设置是一个 28 字节的结构映射到窗体或报表的 页面设置 对话框中的 页边距 选项卡上的设置。
PrtMip 属性具有以下成员。
成员 | 说明 |
---|---|
LeftMargin、RightMargin、TopMargin、BottomMargin | 一个 Long 类型的值,指定页面边缘与要以 twips 为单位打印的项目之间的距离。 |
DataOnly | 指定打印元素的 Long 值。 如果 为 True,则仅打印数据表视图、窗体或报表中的表或查询中的数据,并禁止显示标签、控件边框、网格线以及显示线条和框等图形。 为 False 时,打印数据、标签及图形。 |
ItemsAcross | A Long that specifies the number of columns across for multiple-column reports or labels. 此成员与“页面设置”对话框“列”选项卡上“网格设置”下的“列数”框的值相等。 |
RowSpacing | Long 值,以磅的 1/20 为单位指定主体节间的水平间距。 |
ColumnSpacing | Long 值,以缇为单位指定主体节间的垂直间距。 |
DefaultSize | 长。 如果 为 True,则使用“设计”视图中的详细信息部分的大小。 如果 为 False,则使用由 ItemSizeWidth 和 ItemSizeHeight 成员指定的值。 |
ItemSizeWidth | A Long that specifies the width of the detail section in twips. 此成员与“页面设置”对话框“列”选项卡上“列尺寸”下的“宽度”框的值相等。 |
ItemSizeHeight | 一个 Long 类型的值,指定以 twips 为单位的详细信息部分的高度。 此成员与“页面设置”对话框“列”选项卡上“列尺寸”下的“高度”框的值相等。 |
ItemLayout | A Long that specifies horizontal (1953) or vertical (1954) layout of columns. 此成员与“页面设置”对话框“列”选项卡上“列布局”下的“先行后列”或“先列后行”选项等效。 |
FastPrint | 保留。 |
Datasheet | 保留。 |
PrtMip 属性设置是在设计视图中,在其他视图中以只读的读/写。
示例
下面的 PrtMip 属性示例演示如何设置具有两个水平列的报表。
Private Type str_PRTMIP
strRGB As String * 28
End Type
Private Type type_PRTMIP
xLeftMargin As Long
yTopMargin As Long
xRightMargin As Long
yBotMargin As Long
fDataOnly As Long
xWidth As Long
yHeight As Long
fDefaultSize As Long
cxColumns As Long
yColumnSpacing As Long
xRowSpacing As Long
rItemLayout As Long
fFastPrint As Long
fDatasheet As Long
End Type
Public Sub PrtMipCols(ByVal strName As String)
Dim PrtMipString As str_PRTMIP
Dim PM As type_PRTMIP
Dim rpt As Report
Const PM_HORIZONTALCOLS = 1953
Const PM_VERTICALCOLS = 1954
' Open the report.
DoCmd.OpenReport strName, acDesign
Set rpt = Reports(strName)
PrtMipString.strRGB = rpt.PrtMip
LSet PM = PrtMipString
' Create two columns.
PM.cxColumns = 2
' Set 0.25 inch between rows.
PM.xRowSpacing = 0.25 * 1440
' Set 0.5 inch between columns.
PM.yColumnSpacing = 0.5 * 1440
PM.rItemLayout = PM_HORIZONTALCOLS
' Update property.
LSet PrtMipString = PM
rpt.PrtMip = PrtMipString.strRGB
Set rpt = Nothing
End Sub
下一个 PrtMip 属性示例显示如何将所有页边距全部设置为 1 英寸。
Public Sub SetMarginsToDefault(ByVal strName As String)
Dim PrtMipString As str_PRTMIP
Dim PM As type_PRTMIP
Dim rpt As Report
' Open the report.
DoCmd.OpenReport strName, acDesign
Set rpt = Reports(strName)
PrtMipString.strRGB = rpt.PrtMip
LSet PM = PrtMipString
' Set margins.
PM.xLeftMargin = 1 * 1440
PM.yTopMargin = 1 * 1440
PM.xRightMargin = 1 * 1440
PM.yBotMargin = 1 * 1440
' Update property.
LSet PrtMipString = PM
rpt.PrtMip = PrtMipString.strRGB
Set rpt = Nothing
End Sub
支持和反馈
有关于 Office VBA 或本文档的疑问或反馈? 请参阅 Office VBA 支持和反馈,获取有关如何接收支持和提供反馈的指南。