CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
不看会后悔的Windows XP之经验谈 简单快捷DIY实用家庭影院
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VB >  基础类

关于DataReport

楼主huater(huater)2000-09-28 20:56:00 在 VB / 基础类 提问

请教各位大侠:  
          如何用DataReport实现横向打印?谢谢! 问题点数:50、回复次数:1Top

1 楼playyuer(退休干部 卧鼠藏虫)回复于 2000-09-29 09:10:00 得分 50

只   需   在   Windows9x的   开   始   目   录   中   选   择   设   置   打   印   机   ,   然   后   选   中   你   使   用   的   打   印   机   ,   修   改   其   属   性   中   纸   张   大   小   及   打   印   方   向   即   可   解   决   问   题   。    
   
  程序解决横向打印:  
  方   法   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    
          这   样   就   可   以   极   大   地   减   少   "报   表   宽   度   大   于   纸   的   宽   度   "的   错   误   !    
          注   :"横   打   "即   :打   印   以   纸   的   宽   边   作   顶   部   。   "纵   打   "即   :打   印   以   纸   的   窄   边   作   顶   部   。   Top

相关问题

  • DataReport
  • Datareport ???
  • about datareport:
  • 关于datareport!
  • datareport问题。
  • DataReport的问题!!!
  • datareport问题??
  • 关于datareport?
  • 关于datareport
  • DataReport问题

关键词

  • me
  • report
  • datareport
  • printer
  • adorecordset
  • commondialog
  • mymin
  • mymax
  • pageset
  • 纸

得分解答快速导航

  • 帖主:huater
  • playyuer

相关链接

  • Visual Basic类图书
  • Visual Basic类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo