在VB6的报表设计DataReport中的问题? 我想vb做不了的,得借住vc 或bc才能解决 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用win api 改变打印机的缺省方向设置 就可以打印完后再恢复原值 . printer.Orientation =2 不行.用api怎么设置? call writeprofilestring()好象不是设置打印机的 我也遇到同样的问题,请高手们详细说说:用API怎样做?谢谢!!! 相关页面:http://simideal.top263.net/http://simideal.top263.net/MyAQ_1.htmhttp://www4.netease.com/~askpro/msg21/qa85.htm《报表打印时,程序显示Orientation为只读属性不能修改》回答: 方 法 一 :用 一 个 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。 方 法 二 :引 用 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 这 样 就 可 以 极 大 地 减 少 "报 表 宽 度 大 于 纸 的 宽 度 "的 错 误 ! 注 :"横 打 "即 :打 印 以 纸 的 宽 边 作 顶 部 。 "纵 打 "即 :打 印 以 纸 的 窄 边 作 顶 部 。 此问题由于溪玥回答。 按上面的方法,第一种方法不行(我用win2000与网络打印机).按第二个方法pageset.dll 或api 可以. VB做一个库房管理软件用MYSQL还是用MSSQL?听听大家的建议 为什么总是出现“报表宽度大于纸的宽度”??? 如何在VB6程序里调用帮助文件? 如何设置form窗口默认字体大小,以后启动vb就不用改了? ★★【win2000/winxp下命令行的详细用法!!有谁知道呀,为什么我着个老出错呀!!】●● 免费制造程序界面,交朋友 如何在视频显示窗口中叠加文字????????? 巴顿!巴顿!巴顿!(无内容) 如何修改自己写的VB可执行文件的图标 小弟求教 怎样获取一个指针的内容 请教如何在程序中检测本机有多少个COM口
打印完后再恢复原值 .
谢谢!!!
http://simideal.top263.net/
http://simideal.top263.net/MyAQ_1.htm
http://www4.netease.com/~askpro/msg21/qa85.htm
《报表打印时,程序显示Orientation为只读属性不能修改》
回答: 方 法 一 :用 一 个 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。
方 法 二 :引 用 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
这 样 就 可 以 极 大 地 减 少 "报 表 宽 度 大 于 纸 的 宽 度 "的 错 误 !
注 :"横 打 "即 :打 印 以 纸 的 宽 边 作 顶 部 。 "纵 打 "即 :打 印 以 纸 的 窄 边 作 顶 部 。 此问题由于溪玥回答。
按第二个方法pageset.dll 或api 可以.