I'm hoping this is an easy thing to fix but I've had a play and a search and can't figure it out!
What I need to do in my system is generate a report, save it to my harddrive as a PDF so that I can then attach it to an email. This all needs to be done programatically. I found your example and have been trying to get it to work but for some reason (I expect I'm missing something obvious) it doesn't like the "response" bit of the code below:
I'm guessing im just missing a "using" statement but the code wont compile past "Response.Clear()". It can't find the response class. I did a search around and people suggested adding "using System.Web" to get it to work but that didn't help. I'm a relative newbie with C# so any help would be appreciated!
7 Answers, 1 is accepted
That works for me.
HTH for you,
Aim - Generate a new report, save it to a temporary directory, automatically attach it to an email (by passing the path into email object)
If anyone else happens to stumble across this code and fancies using it, just beware that every time you create a new document using this code, it will overwrite the previous file. It is best to generate a unique filename but for our software our client wanted a specified filename. Luckily we only have 1 user of this section of the system so it wont be an issue for us.
I am trying to export my report to PDF programatically and I get this error 'Entry point was not found.' on the code line
I searched for the error 'Entry point was not found.' and it says that if there is some kind of mismatch in the report version then it happens but for my machine same report runs in the reportviewer.
I also wanted to add that I am using
When I use the reportviewer then the needdatasource event runs but when I use the reportProcessor.RenderReport then the needdatasource event does not run. I have few public variables in the report which I am using to pass the parameter to the report.
Can somebody help me with this urgently?
The data you need to save to disk is in "result.DocumentBytes".
Edit the code you posted to remove all references to/use of the response object as this is only relevanmt when rendering the document back to a web page.
You then simply need to add code to save the byte array in "result.DocumentBytes" to disk. Try using a BinaryWriter object.
It helped me a lot!