0

I am building an application in c# using Visual studio 2010 with access database. I am using reportviewer of visual studio to view the reports which is working fine for me.

It has option to export your report in excel, PDF or word which needs to be saved first and then could be opened. But I want to open that report in excel without having to save it first.

I don't know if it is possible or not if it is kindly show me how? I will paste some pictures how it works

Here in the first step you will have to click on the export into one of the three

Then you would need to save the report

After saving, you can than open the report in excel, PDF or word but I would like to skip the second step of saving it and directly open it in excel.

James Z
  • 12,209
  • 10
  • 24
  • 44
Awsm
  • 1
  • 3
  • How would the data go into excel if there's no file? Even outlook saves attachments to files before showing them. Why would you do something a lot more complex? – James Z May 01 '20 at 04:10
  • It's a strange request from a client. He wants to see every report in excel but do not want to save each report (hope it make sense). Now I have no idea if it is even possible or not. – Awsm May 01 '20 at 10:21

1 Answers1

0

You can handle ReportExport event of ReportViewer and set e.Cancel=true; then using Render method of its LocalReport or ServerReport property, export it to desired location.

ReportViewer - Export report programmatically to a specific location without showing save dialog

save the file in TempFolder ... after it saved , you can open it directly:

System.Diagnostics.Process.Start(@"YOUR_PATH");
NajiMakhoul
  • 1,623
  • 2
  • 16
  • 30