I currently have a Windows Forms ReportViewer
that fetches information from an SSRS
report.
When the information is fetched I have the option to export them to a PDF, Word or Excel document, to do this, first, I need to save to see the document.
I would rather have it the other way, which is, export the results to a specific file and then, save the document if that's my choice.
Is this possible?
You can handle
ReportExport
event ofReportViewer
and sete.Cancel=true;
then usingRender
method of itsLocalReport
orServerReport
property, export it to desired location.Use
LocalReport
for rdlc reports andServerReport
for rdl reports. In below code I decided to use the property using value ofProcessingMode
.This way, when the user clicks on one of available options in
Export
button, the report will be exported to the specified format at the location which you set in code:Note: Also don't forget to attach
reportViewer1_ReportExport
toReportExport
using designer or code, if you forget you will see the dialog.