jinqiong 发表于 2013-10-21 16:38:00

ActiveReport的属性在vb.net中如何设置

1.vb6中
activeReport1.Printer = activeReport2.Printer
现在在vb.net中报错,因为它是ReadOnly的,这个该如何修改?

2.vb6中
activeReport.Zoom = -2
这个属性在vb.net中应该对应哪个?

3.vb6中
activeReport.Printer.Copies
在vb.net中应该如何对应

谢谢。

ZenosZeng 发表于 2013-10-21 17:59:00

1、需要设置Printer.PrintName

2、viewer1.Zoom

3、Document.Printer.PrinterSettings.Copies

jinqiong 发表于 2013-10-22 09:31:00

2、viewer1.Zoom
viewer1这个在我们的程序里面没有用到,
现在是如果要用的话,是不是一定要追加引用啊?
那这个viewer1的命名空间是什么啊

3.activeReport.Printer.Orientation
这个的话在Document.Printer.PrinterSettings下面没有找到
但在activeReport.PageSettings.Orientation下面找到了,
但是不知道是否对应是正确的

ZenosZeng 发表于 2013-10-22 13:48:00

2. 需要添加GrapeCity.ActiveReports.Viewer.Win.v7命名空间

3.Orientation是通过PageSettings.Orientation进行设置的

jinqiong 发表于 2013-10-22 14:41:00

不好意思,我想确认一下,
viewer1是在GrapeCity.Viewer.Common.ViewModel.ViewTypeViewModel这个类下面吗?

jinqiong 发表于 2013-10-22 14:58:00

追加问题
1.activeReport.Export(xls)
这个在vb.net中对应的的方法是什么

2.activeReport.ShowDialog()
这个是否可以用activeReport.run()

3.Unload(activeReport)
vb.net没有Close方法,这个要改成什么呢

4.activeReport.Document.Printer.PrintDialog(form.Handle.ToInt32)
因为Printer下面的Print()方法是没有参数的,
那这个是否是直接把参数去掉,改成Print()方法就好了?

谢谢。

ZenosZeng 发表于 2013-10-22 16:02:00

1. 通过 XlsExport 进行导出,或者 Viewer.Export 导出
// Export the report in XLSX format.
GrapeCity.ActiveReports.Export.Excel.Section.XlsExport xlsExport1 = new GrapeCity.ActiveReports.Export.Excel.Section.XlsExport();xlsExport1.FileFormat = GrapeCity.ActiveReports.Export.Excel.Section.FileFormat.Xlsx;
// Set the file format of the exported excel file to Xlsx to support Microsoft Excel 2007 and newer versions.
xlsExport1.Export(rpt.Document, Application.StartupPath + "\\XLSExpt.xlsx");


2. 需要通过Viewer来显示报表

3..NET中无需此功能

4.调用Document.Print()方法即可

jinqiong 发表于 2013-10-23 14:49:00

2. 需要通过Viewer来显示报表
是什么意思?
有没有例子之类的
因为以前从来没有接触过,所以麻烦啦,谢谢。

viewer是在GrapeCity.Viewer.Common.ViewModel.ViewTypeViewModel这个类下面的吗?

ZenosZeng 发表于 2013-10-23 14:55:00

在使用 VB.NET 开发WinForms应用程序时,打开Form设计界面在工具箱中可以找到 Viewer 控件,此控件是用于显示报表使用的。

也就是说将 Viewer 添加到 Form 上,然后通过后台代码创建报表对象并传递给 Viewer
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
      Dim rpt As New SectionReport1
      rpt.DataSource = New DataTable()
      rpt.Run()
      Viewer1.Document = rpt.Document
    End Sub

jinqiong 发表于 2013-10-23 14:55:00

4.activeReport.Document.Printer.PrintDialog(form.Handle.ToInt32)
vb6里面返回的是个Boolean类型的

但是Document.Print()方法没有返回值
页: [1] 2 3
查看完整版本: ActiveReport的属性在vb.net中如何设置