asp.net - exporting rdlc report into pdf on button click -
Hi Anyone can help me with this.
I have the RDLC report displayed on my web page using Asp.net and C # .net I want to export it to PDF on button click.
Can you help me?
Thank you
I did something like that sometime ago. Below is the code I used in the page_load event of a page, it is in VB and it is not the best code in the world, but you can get help to get the solution.
Completed = request as action ("job") dim RV Reporting.WebForms.ReportViewer Dim R string = "apps / report / legal_document.rdlc" dim ds new jobmanagerTableAdapters.JobInformationTableAdapter dim DS2 New ordermanagementTableAdapters.RecoveryItemsInformationTableAdapter dim DS3 New expensemanagerTableAdapters.tbl_expensesTableAdapter dim DS4 New ordermanagementTableAdapters.tbl_orders_collection_itemsTableAdapter dims as DS5 As in as new attachmentsmanagerTableAdapters.tbl_attachmentsTableAdapter dim ds6 New notesmanagerTableAdapters.tbl_notesTableAdapter dim ds7 New payments_managerTableAdapters.tbl_paymentsTableAdapters.tbl_paymentsTableAdaptor dim rptSource1 New Microsoft.Reporting.WebForms.ReportDataSource dim rptSource2 New Microsoft.Reporting.WebForms.ReportDataSource dim rptSource3 as new as Microsoft.Reporting.WebForms as as AS. Rep. OrtDataSource Dim rptSource4 as the new Microsoft. Reporting. WebForms.ReportDataSource Dim rptSource5 as the new Microsoft. Reporting. WebForms.ReportDataSource Dim rptSource6 New Microsoft.Reporting.WebForms.ReportDataSource Dim as Rptsource7 New Microsoft.Reporting.WebForms.ReportDataSource rptSource1.Name = "jobmanager_JobInformation" rptSource1.Value = ds.GetJobInfobyJobID (jobid) rptSource2.Name = "ordermanagement_RecoveryItemsInformation" Rptsors2kvalu = Ds2kgetrekveryitmsbyjobidorderid (Jobid, 0) Rptsors3knam = "Akspensemnagr_tbl_akspenses" Rptsors3kvalu = Ds3kgetakspensesbijobidorderid (Jobid, 0) Rptsors4knam = "Ordermangement_tbl_ordrs_klekshn_aitms" Rptsors4kvalu = Ds4kgetdaatbijobidorderid (Jobid, 0) RptSource5.Name = "attachmentsmanager_tbl_attachments" rptSource5.Value = ds5.GetAllAttachmentsbyJobID (jobid) rptSource6.Name = "notesmanager_tbl_notes" rptSource6.Value = ds6.GetAllNotesbyJobID (Job ID) Rptsource7.Name = "payments_manager_tbl_payments" rptsource7.Value = ds7.GetPaymentsbyJobID ( Jabid) rv.LocalReport.DataSourc Es.Clear () rv.LocalReport.ReportPath = r.ToString rv.LocalReport.DataSources.Add (rptSource1) rv.LocalReport DataSources.Add (rptSource2) rv.LocalReport.DataSources.Add (rptSource3) rv.LocalReport.DataSources.Add (RptSource4) rv.LocalReport.DataSources.Add (rptSource5) rv.LocalReport.DataSources.Add (rptSource6) rv.LocalReport Alert Warning () = nothing as dimension string () = nothing dim mimeType String = nothing as dim = encoding string = nothing dim dimension in the form of an extension string [page 1] (rptsource7) 'page Control. Get the folder on the web server from the byte () 'web.config Dim folder as the bytes in the String folder location as the location string folder location = Server.MapPath ("Report")' Firstly remove the existing file Dynamic File Path String = folder location & amp; "\ Legal.PDF" file.Delete (filepath) 'then create new PDF file bytes = RVL. Local Report .Render ("PDF", nothing, mime type, _ encoding, extension, stream, warning) New file stream (folder location & "Amp;" legal.PDF), FileMode.Create) fs.Write (byte, 0, bytes. Length) fs.Close () Response.Redirect ("reports / legal.pdf")
Comments
Post a Comment