找回密码
 立即注册

QQ登录

只需一步,快速开始

travel_he

初级会员

21

主题

67

帖子

202

积分

初级会员

积分
202

活字格认证

travel_he
初级会员   /  发表于:2017-2-10 14:01  /   查看:3926  /  回复:9
本帖最后由 Lenka.Guo 于 2017-2-10 16:16 编辑

WebViewer导出按钮要自行定义,建议代码:

        Dim btnCSV As GrapeCity.ActiveReports.Web.Controls.ToolButton = GrapeCity.ActiveReports.Web.Controls.Tool.CreateButton("CSV")
        btnCSV.ToolTip = "导出到 CSV"
        btnCSV.Caption = "导出到 CSV"
        btnCSV.ClickNavigateTo = "ARExport.ashx?ExportType=CSV" '设置点击按钮执行的服务
        Me.WebViewer1.FlashViewerToolBar.Tools.Add(btnCSV) '添加按钮到 FlashViewer 中

这样就有一个问题,不同类型导出各自一个按钮,数量众多,而且是文字按钮不美观,可事定义一个下拉的图形按钮,这样既美观又节省地方!

有否建议代码???

9 个回复

倒序浏览
Lenka.Guo讲师达人认证 悬赏达人认证
超级版主   /  发表于:2017-2-10 14:11:12
沙发
您可以参考博客:http://blog.gcpowertools.com.cn/ ... export-options.aspx

在前端代码中添加 select控件。
回复 使用道具 举报
travel_he
初级会员   /  发表于:2017-2-10 15:32:18
板凳
有VB代码的版本吗?
回复 使用道具 举报
Lenka.Guo讲师达人认证 悬赏达人认证
超级版主   /  发表于:2017-2-10 16:15:56
地板
没有VB示例,其实后端没有太大差异,只是前端JS 为webveiwer TOOLBAR 绑定了<select >控件
回复 使用道具 举报
travel_he
初级会员   /  发表于:2017-2-13 08:56:28
5#
而且由于版本不对有些方法都有出入!!!
如:
                    //Create the HTML export object
                    //GrapeCity.ActiveReports.Export.Html.Section.HtmlExport htmlExport1 = new GrapeCity.ActiveReports.Export.Html.Section.HtmlExport();
                    GrapeCity.ActiveReports.Export.Html.Page.HtmlRenderingExtension htmlExport1 = new GrapeCity.ActiveReports.Export.Html.Page.HtmlRenderingExtension();


                    //Export the report to HTML in this session's webcache
                    CustomHtml.MyCustomHtmlOutputter outputter = new CustomHtml.MyCustomHtmlOutputter(this.Context);
                    
                    htmlExport1.Export(rpt.Document, outputter, "");
                    Response.Redirect("ReportOutput" + "/" + System.IO.Path.GetFileName(outputter.mainPage));


htmlExport1.Export这个方法在AR10下就有错,有针对AR10的代码吗?
回复 使用道具 举报
Lenka.Guo讲师达人认证 悬赏达人认证
超级版主   /  发表于:2017-2-13 09:11:05
6#
这个博客中所涉及的.export 方法同样存在于AR10 中,未找到相关方法是因为缺少引用:GrapeCity.ActiveReports.Export.Html.v10,把这个dll添加到项目中即可。

详情参考博客: http://blog.gcpowertools.com.cn/post/exportreport.aspx
回复 使用道具 举报
travel_he
初级会员   /  发表于:2017-2-13 10:08:07
7#
本帖最后由 travel_he 于 2017-2-13 10:12 编辑

此文件已引用,否则GrapeCity.ActiveReports.Export.Html.Page.HtmlRenderingExtension htmlExport1 = new GrapeCity.ActiveReports.Export.Html.Page.HtmlRenderingExtension();
就会报错!!



是否还有其它文件也需要引用?

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复 使用道具 举报
Lenka.Guo讲师达人认证 悬赏达人认证
超级版主   /  发表于:2017-2-13 10:30:31
8#
HTMLExport 和HtmlRenderingExtension 是导出的两种方式。

如果您想要使用HtmlExport ,先引入GrapeCity.ActiveReports.Export.Html.v10,然后添加以下代码(博客中有VB 代码的写法):
  1. ' Export the report in HTML format.
  2. Dim HtmlExport1 As New GrapeCity.ActiveReports.Export.Html.Section.HtmlExport()
  3. HtmlExport1.Export(MyDocument, Application.StartupPath + "\HTMLExpt.html")
复制代码



如果需要使用HtmlRenderingExtension ,也需要引入GrapeCity.ActiveReports.Export.Html.v10 dll,然后添加以下代码
  1. ' Provide the page report you want to render.
  2. Dim report As New GrapeCity.ActiveReports.PageReport(New System.IO.FileInfo("C:\Sample_PageReport.rdlx"))
  3. Dim reportDocument As New GrapeCity.ActiveReports.Document.PageDocument(report)

  4. ' Create a directory
  5. Dim outputDirectory As New System.IO.DirectoryInfo("C:\MyHTML")
  6. outputDirectory.Create()

  7. ' Provide settings for your rendering output.
  8. Dim htmlSetting As New GrapeCity.ActiveReports.Export.Html.Page.Settings()
  9. Dim setting As GrapeCity.ActiveReports.Extensibility.Rendering.ISettings = htmlSetting

  10. ' Set the rendering extension and render the report.
  11. Dim htmlRenderingExtension As New GrapeCity.ActiveReports.Export.Html.Page.HtmlRenderingExtension()
  12. Dim outputProvider As New GrapeCity.ActiveReports.Rendering.IO.FileStreamProvider(outputDirectory, System.IO.Path.GetFileNameWithoutExtension(outputDirectory.Name))
  13. reportDocument.Render(htmlRenderingExtension, outputProvider, htmlSetting)
复制代码


回复 使用道具 举报
travel_he
初级会员   /  发表于:2017-2-14 09:11:18
9#
回复 使用道具 举报
Lenka.Guo讲师达人认证 悬赏达人认证
超级版主   /  发表于:2017-2-14 09:27:03
10#
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部