ReportViewer导出 [英] ReportViewer Export

查看:107
本文介绍了ReportViewer导出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法以编程方式显示ReportViewer的"导出"对话框?请注意,我想显示"导出"对话框,而不是实际导出报告。代码应完全等同于按下reportviewer工具栏上的"导出"按钮。 (这是Windows应用程序,而不是网站。)

解决方案


HI,
下面的代码将提供导出为PDF,您可以更改为" EXCELL"将PDF输出到excell,在提供数据源和报告路径后使用此代码,它将直接弹出"打开"状态。 [储存" " CANCLE"报告对话框。

昏暗警告正如Microsoft.Reporting.WebForms.Warning()= Nothing


Dim streamids As String() = Nothing


Dim mimeType As String = Nothing


Dim encoding As String = Nothing


Dim extension As String = Nothing


Dim bytes As Byte()


Dim DeviceInfo As String ="< DeviceInfo>" _


& " < OUTPUTFORMAT> PDF< / OUTPUTFORMAT>" _


& " <页宽> 7.7in< /页宽>" _


& " < PageHeight> 11英寸< / PageHeight>" _


& " < MarginTop> 0.39in< / MarginTop>" _


& " < MarginLeft> 0.64in< / MarginLeft>" _


& " < MarginRight> 0.25英寸< / MarginRight>" _


& " < MarginBottom> 0.39in< / MarginBottom>" _


& "< / DeviceInfo>"


'将pdf设置呈现给ReportViewer


< font face = Arial size = 5>

bytes = reportViewer1.LocalReport.Render(" PDF",DeviceInfo,mimeType,





编码,扩展,流,警告)



Response.Clear()


Response.ContentType = mimeType


Response.AddHeader(" content-disposition"," attachment; filename = Sample" extension)


Response.BinaryWrite(bytes)


< p dir = ltr align = left> Response.End()

希望这会对你有所帮助

-Raja Sekhar K



Hi, Is there any way to show the Export dialog of ReportViewer programmatically? Please note that I want to show the Export dialog and not actually export the report. The code should be an exact equivalent of pressing the Export button on the reportviewer toolbar. (This is a Windows application, not a website).

解决方案

HI,
Below code will provide exporting to PDF, you can change to "excell" insted of PDF to export to excell,
use this code after you provide the data source and report path, it will pop up directly "open" "save" "cancle" dialog of the report.

Dim warnings As Microsoft.Reporting.WebForms.Warning() = Nothing

Dim streamids As String() = Nothing

Dim mimeType As String = Nothing

Dim encoding As String = Nothing

Dim extension As String = Nothing

Dim bytes As Byte()

Dim DeviceInfo As String = "<DeviceInfo>" _

& " <OutputFormat>PDF</OutputFormat>" _

& " <PageWidth>7.7in</PageWidth>" _

& " <PageHeight>11in</PageHeight>" _

& " <MarginTop>0.39in</MarginTop>" _

& " <MarginLeft>0.64in</MarginLeft>" _

& " <MarginRight>0.25in</MarginRight>" _

& " <MarginBottom>0.39in</MarginBottom>" _

& "</DeviceInfo>"

'Rendering pdf settings to ReportViewer

bytes = reportViewer1.LocalReport.Render("PDF", DeviceInfo, mimeType,

 

encoding, extension, streamids, warnings)

Response.Clear()

Response.ContentType = mimeType

Response.AddHeader("content-disposition", "attachment;filename=Sample"extension)

Response.BinaryWrite(bytes)

Response.End()

Hope this will help you

-Raja Sekhar K


这篇关于ReportViewer导出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆