Click here to Skip to main content
13,150,178 members (32,514 online)
Rate this:
Please Sign up or sign in to vote.
See more:
I have a Winform Application in which i have 2 separate rdlc's now on click of button i need generate the report with out reportViewer and to save the report as 2 separate .pdf files.

Any suggestions please!
Posted 1-Aug-12 21:06pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

sorry i cannot copy and paste code, but i have done this before, its very easy as far as i remember.

1.) Initialize ReportViewer
2.) Set the LocalReport-Path
3.) Use the Export to save it to disk

Code should be something along those lines:

ReportViewer rv = new ReportViewer();
rv.LocalReport.ReportPath = @"resources\test.rdlc";
File.WriteAllBytes(@"c:\my.pdf", rv.LocalReport.Render("PDF"));
rohit24c 2-Aug-12 4:58am
its show "An error occurred during local report processing". at 3rd line in your code.
Basically its a rdlc which has subreport and i am having dataset in that rdlc
efkah 2-Aug-12 5:45am
Third Line? I would have expected second line, as i said, the lines are to be understood as pseudo-code;-)
try rv.Update() or rv.Show() in between the lines to force the data to be loaded (i editted my solution).
If this doesnt work, look up the Render-Method of the LocalReport:
I am sorry, i cant help you any further within the next probably 10 hours, and until then i will have forgotten you, so better not expect further help.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2


Please try this

<rsweb:ReportViewer ID="Report1" runat="server" Font-Names="Verdana" Font-Size="8pt"
    Height="515px" Width="100%" ShowExportControls="true" SizeToReportContent="False" >
    <LocalReport ReportPath="Rdlc\reports1.rdlc" EnableHyperlinks="True">
            <rsweb:ReportDataSource DataSourceId="ObjectDataSource1" Name="reports1_reports1" />
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetData"

//Code behind

  ReportDataSource datasource = new

                Report1.Visible = true;

For more ref:[^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web04 | 2.8.170924.2 | Last Updated 2 Aug 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100