好象用datareport不行,你可以用printer对象的Orientation 属性
解决方案 »
- 求一个可以直接把文件夹压缩成ZIP文件的控件
- 菜鸟问题--在VB中如何通过Telnet登录远程计算机?
- 求搜索引擎资料
- 到公司半年多,终于有机会座飞机出差!庆祝一下,回来结贴!
- image控件--如何使鼠标在上面时,鼠标指针变成手的形状,离开时还原?(半天结贴!)
- 我是个学生,急需一个计算机二级证,请问vb语言还是c语言好学?
- 祝我的朋友ivy生日快乐!天天顺心!!越装越漂亮!!!
- 一个小小界面问题请教!
- 我写了一个小程序,用到了SSTab控件,想做个绿色软件,可到了没有SSTab控件的机器上该如何运行
- 想在explorer中实现文档文件预览 即鼠标移到某个文件上自动出来一个窗体来预览这个文件 vb能否实现?
- 如何判断ListView是否存在Key="ABC" 的list对象。会者不难,熟手请看!
- Winsock???
方 法 1: 装VB6SP4,DataReport新添了Orientation属性
参 考 :微 软 的 Knowledge Base的 文 章:“Q197915 PRB Report Width is Larger than the Paper Width”
Q253555 - FIX Error Message Report Width Is Larger Than the Paper Width on Exporting Data Report.htm
方 法 2:
用 一 个 CommonDialog:
Private Sub Command1_Click()
CommonDialog1.Flags = cdlPDPrintSetup
CommonDialog1.CancelError = True
On Error GoTo ErrorHandle:
CommonDialog1.ShowPrinter '必 须 Show出 来 且 "确 定 "才 能 修 改 纸 方 向
'Me.Refresh
'Command1.Refresh
On Error GoTo 0
DataReport1.Show vbModal
ErrorHandle:
End Sub
下 载 例 程 rptdemo.zip。
方 法 3: 引 用 PageSet.Dll(参 考 :微 软 的 Knowledge Base的 文 章:“Q198901 Sample PageSet_exe Programmatically Changes Default Printer Orientation” 并 下 载 PageSet.exe,或 orientation.zip。
但 有 时 报 出 "报 表 宽 度 大 于 纸 的 宽 度 "的 错 误 。 (参 考 :微 软 的 Knowledge Base的 文 章:“Q197915 PRB Report Width is Larger than the Paper Width” (我 认 为 没 什 么 用 ,不 知 所 云 ))
该 方 法 并 未 真 正 将 Printer改 方 向 (即 :Printer.Width与 Printer.Height并 未 交 换 ),因 此 我 建 议 :
Private Sub DataReport_Initialize()
Const ErrX = 0 '误 差 经 验 值
Dim adoRecordset As New ADODB.Recordset
adoRecordset.Fields.Append "Fld1", adVariant, , adFldIsNullable + adFldMayBeNull
adoRecordset.Open
Set Me.DataSource = adoRecordset
'下 一 句 非 常 关 键 重 要 ,可 以 极 大 地 减 少 "报 表 宽 度 大 于 纸 的 宽 度 "的 错 误 !
'当 Form1.Option1.Value为 真 时 "横 打 ",否 则 "纵 打 "
Me.ReportWidth = IIf(Form1.Option1.Value, MyMax(Printer.Width, Printer.Height),
MyMin(Printer.Width, Printer.Height)) - Me.LeftMargin - Me.RightMargin-ErrX
End Sub
Private Function MyMax(a As Long, b As Long) As Long
MyMax = IIf(a > b, a, b)
End Function
Private Function MyMin(a As Long, b As Long) As Long
MyMin = IIf(a < b, a, b)
End Function
这 样 就 可 以 极 大 地 减 少 "报 表 宽 度 大 于 纸 的 宽 度 "的 错 误 !
注 :"横 打 "即 :打 印 以 纸 的 宽 边 作 顶 部 。 "纵 打 "即 :打 印 以 纸 的 窄 边 作 顶 部