以编程方式保存pdf格式的rdlc报告的简单代码 [英] simple code for save rdlc report in pdf format programatically

查看:94
本文介绍了以编程方式保存pdf格式的rdlc报告的简单代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好..

请在vb.net windows application.i中自动发送一个简单的代码,以PDF格式保存RDLC报告。尝试多种方式但没有用,我搜索所有谷歌链接面向这个主题,但我不能低估它是如何做的,所以请发送简单的vb.net代码。

Hi All..
please send a simple code for save RDLC report in PDF format automatically in vb.net windows application.i try to many way but no use, i search the all google links oriented for this topic but i can't understated how it's doing, so pls send the easy vb.net code.

推荐答案

save-rdlc-reports-as-pdf-programaticaly [ ^ ]



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



查看链接。 .hope它会帮助..
save-rdlc-reports-as-pdf-programaticaly[^]

how to programatically save RDLC report in PDF format using vb.net[^]

Check the links..hope it will help..


我解决自己:

我的代码在下面

步骤:1

创建一个简单的rdlc报告添加2个文本框,并在textbox1和textbox2中设置name1和name2的名称。



步骤:2

转到表单1并添加报表查看器1,双击表单并粘贴以下代码。



进口Microsoft.Reporting.WinForms

进口System.IO



公共类Form1

私有子Form1_Load(发件人为对象,e为EventArgs)处理MyBase.Load

Dim param(1)As ReportParameter

param(0)=新的ReportParameter(name1,abc)'name1 = relc报告中的参数,abc='name1的值它的用户定义

param(1)= New ReportParameter(name2,abc)'与name1相同

Me.ReportViewer1.LocalReport.SetParameters(param)

Me。 ReportViewer1.RefreshReport()

Me.ReportViewer1.LocalReport.DataSources.Clear()



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

将newFile作为新FileStream调用(C:\ Users \SathishKumar \Desktop\New folder \ myReport.pdf,FileMode.Create)

newFile.Write(byteViewer,0,byteViewer.Length)

newFile.Close()

End Sub
I Solve Myself:
my code is below
step:1
create a simple rdlc report add 2 textbox's and set the parameter in textbox1 and textbox2 the name of name1 and name2.

step:2
go to form 1 and add report viewer1,double click the form and paste the below code.

Imports Microsoft.Reporting.WinForms
Imports System.IO

Public Class Form1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim param(1) As ReportParameter
param(0) = New ReportParameter("name1", "abc")' name1=parameter in relc report, "abc"= 'value of name1"it's user defined"
param(1) = New ReportParameter("name2", "abc")'same as name1
Me.ReportViewer1.LocalReport.SetParameters(param)
Me.ReportViewer1.RefreshReport()
Me.ReportViewer1.LocalReport.DataSources.Clear()

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("C:\Users\SathishKumar\Desktop\New folder\myReport.pdf", FileMode.Create)
newFile.Write(byteViewer, 0, byteViewer.Length)
newFile.Close()
End Sub
<pre lang="vb">



结束课











步骤:3



享受编码:)


End Class





step: 3

Enjoy Coding:)


这篇关于以编程方式保存pdf格式的rdlc报告的简单代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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