如何在vb.net windows应用程序中以Pdf格式保存RDLC报告 [英] How to save RDLC report in Pdf format in vb.net windows application

查看:102
本文介绍了如何在vb.net windows应用程序中以Pdf格式保存RDLC报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨..

我正在开发报告系统,我正在使用RDLC生成报告,我几乎完成了我的报告工作,现在我的问题是报告是自动创建的Pdf格式并发送特定的客户电子邮件ID,我不知道怎么可能,所以请发送你的想法,

请帮我...

解决方案

< blockquote>看看这些......

如何在不使用ReportViewer的情况下将rdlc报告导出为PDF [ ^ ]

如何使用vb.net以编程方式保存PDF格式的RDLC报告 [ ^ ]

从RDLC报告中保存PDF文件 [ ^ ]

以编程方式将RDLC报告保存为PDF [ ^ ]


试用此代码:



 ' 创建ReportViewer的实例

Dim viewer As New Microsoft.Reporting.WinForms.ReportViewer()

'
设置本地报告
' 注意:MyAppNamespace引用应用程序的命名空间。
viewer.LocalReport.ReportEmbeddedResource =MyAppNamespace.Report1.rdlc

'
创建报表数据源
Dim rptDataSource As New Microsoft.Reporting.WinForms.ReportDataSource( Product,data)
viewer.LocalReport.DataSources.Add(rptDataSource)

' 导出为PDF。获取二进制内容。
Dim pdfContent As Byte()= viewer.LocalReport.Render(PDF,Nothing,Nothing,Nothing,Nothing,Nothing,Nothing)

'
Creatr PDF文件disk
Dim pdfPath As String = C :\ temp \report.pdf
Dim pdfFile As New System.IO.FileStream(pdfPath,System.IO.FileMode.Create)
pdfFile.Write(pdfContent, 0 ,pdfContent.Length)
pdfFile.Close()


我解决了这个问题简单的代码,我的代码在下面



  Dim  byteViewer  As   Byte ()= ReportViewer1.LocalReport.Render(  PDF
Dim saveFileDialog1 As SaveFileDialog()
saveFileDialog1.Filter = * PDF文件(* .pdf)| * .pdf
saveFileDialog1.FilterIndex = 2
saveFileDialog1。 RestoreDirectory = True
Dim newFile As FileStream( D:\ Company Reckon发票(ExE)\ PDF文件\发票到期详情&客户端和 。pdf,FileMode.Create)
newFile.Write(byteViewer, 0 ,byteViewer.Length)
newFile.Close()


Hi..
I developing the report system, i am using RDLC for Generate report, i am almost finish my report work,now my problem is the report is automatically create in Pdf format and send the particular client email-id,i don't how it's possible, so pls send your ideas,
pls help me...

解决方案

Have a look at these...
How to export rdlc report to PDF without using ReportViewer[^]
how to programatically save RDLC report in PDF format using vb.net[^]
Save PDF file from RDLC Reports[^]
Save RDLC reports as PDF programatically[^]


Try this code:

'Create an instance of ReportViewer
    
Dim viewer As New Microsoft.Reporting.WinForms.ReportViewer()

    'Set local report
    'NOTE: MyAppNamespace refers to the namespace for the app.
    viewer.LocalReport.ReportEmbeddedResource = "MyAppNamespace.Report1.rdlc"
                
    'Create Report Data Source
    Dim rptDataSource As New Microsoft.Reporting.WinForms.ReportDataSource("Product", data)
    viewer.LocalReport.DataSources.Add(rptDataSource)

    'Export to PDF. Get binary content.
    Dim pdfContent As Byte() = viewer.LocalReport.Render("PDF", Nothing, Nothing, Nothing, Nothing, Nothing, Nothing)

    'Creatr PDF file on disk
    Dim pdfPath As String = "C:\temp\report.pdf"
    Dim pdfFile As New System.IO.FileStream(pdfPath, System.IO.FileMode.Create)
    pdfFile.Write(pdfContent, 0, pdfContent.Length)
    pdfFile.Close()


I Solve this problem in simple code, my code is below

Dim byteViewer As Byte() = ReportViewer1.LocalReport.Render("PDF")
            Dim saveFileDialog1 As New SaveFileDialog()
            saveFileDialog1.Filter = "*PDF files (*.pdf)|*.pdf"
            saveFileDialog1.FilterIndex = 2
            saveFileDialog1.RestoreDirectory = True
            Dim newFile As New FileStream("D:\Company Reckon Invoice(ExE)\PDF Files\Invoice Due Details" & clientno & ".pdf", FileMode.Create)
            newFile.Write(byteViewer, 0, byteViewer.Length)
            newFile.Close()


这篇关于如何在vb.net windows应用程序中以Pdf格式保存RDLC报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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