[access报表]报表中使用自定义纸张,及设置自定义纸张大小
时 间:2009-05-08 08:39:23
作 者:UMVSoft整理 ID:1445 城市:上海
摘 要:报表中使用自定义纸张,及设置自定义纸张大小
正 文:
报表中使用自定义纸张,及设置自定义纸张大小
Private Type str_DEVMODE
RGB As String * 94
End Type
Private Type type_DEVMODE
strDeviceName As String * 32
intSpecVersion As Integer
intDriverVersion As Integer
intSize As Integer
intDriverExtra As Integer
lngFields As Long
intOrientation As Integer
intPaperSize As Integer
intPaperLength As Integer
intPaperWidth As Integer
intScale As Integer
intCopies As Integer
intDefaultSource As Integer
intPrintQuality As Integer
intColor As Integer
intDuplex As Integer
intResolution As Integer
intTTOption As Integer
intCollate As Integer
strFormName As String * 32
lngPad As Long
lngBits As Long
lngPW As Long
lngPH As Long
lngDFI As Long
lngDFr As Long
End Type
' rptName: 为报表名称
Public Sub CheckCustomPage(ByVal rptName As String)
Dim DevString As str_DEVMODE
Dim DM As type_DEVMODE
Dim strDevModeExtra As String
Dim rpt As Report
Dim intResponse As Integer
' 在设计视图下打开报表
DoCmd.OpenReport rptName, acDesign
Set rpt = Reports(rptName)
If Not IsNull(rpt.PrtDevMode) Then
strDevModeExtra = rpt.PrtDevMode
' 获取当前的 DEVMODE 结构
DevString.RGB = strDevModeExtra
LSet DM = DevString
If DM.intPaperSize = 256 Then
' 显示用户自定义纸张的尺寸
intResponse = MsgBox("当前的自定义纸张为(mm):" & _
DM.intPaperWidth / 10 & " 宽 X " & _
DM.intPaperLength / 10 & " 长。 你想改变吗?", _
vbYesNo + vbQuestion)
Else
' 非自定义纸张
intResponse = MsgBox("报表没有使用自定义纸张。 " & _
"你想使用自定义纸张吗?", vbYesNo + vbQuestion)
End If
If intResponse = vbYes Then
' 用户要改变纸张设置,初始化 DM 的各个域
DM.lngFields = DM.lngFields or DM.intPaperSize or _
DM.intPaperLength or DM.intPaperWidth
' 设置为自定义纸张
DM.intPaperSize = 256
' 提示输入长度和宽度
DM.intPaperLength = InputBox("请输入纸张的长度(mm):") * 10
DM.intPaperWidth = InputBox("请输入纸张的宽度(mm):") * 10
' 更新属性值
LSet DevString = DM
Mid(strDevModeExtra, 1, 94) = DevString.RGB
rpt.PrtDevMode = strDevModeExtra
End If
End If
Set rpt = Nothing
End Sub
Access软件网QQ交流群 (群号:483923997) Access源码网店
常见问答:
技术分类:
源码示例
- 【源码QQ群号19834647...(12.17)
- 【Access窗体导出PDF】...(04.08)
- 【Access窗体导出PDF】...(04.07)
- Access两种方式实现即时更...(03.01)
- Access隐藏与显示lacc...(01.12)
- 【Access高效办公】将每个...(12.23)
- Access21点游戏源代码(12.13)
- 【Access窗体导出Exce...(11.15)
- 【Access开发】Acces...(11.14)
- 通过Access宏录入数据到选...(11.10)
学习心得
最新文章
- Access学习笔记--用Acce...(04.19)
- 【Access重复项查询示例】将A...(04.17)
- Access快速开发平台企业版--...(04.16)
- 【Access模块示例】通过模块代...(04.15)
- Access查询里面分组合计功能添...(04.13)
- 【Access删除查询】删除数字最...(04.12)
- 显示文件夹中所有文件的修改时间(04.11)
- 铁路工程管理系统;铁路工程管理小程...(04.10)
- 【Access查询示例】怎么将两个...(04.09)
- 【Access窗体导出PDF】Ac...(04.08)