Last post Jul 14, 2010 10:44 AM by aspfun
Jul 13, 2010 03:32 PM|aspfun|LINK
I created a Crystal Report which datasource is a store procedure.
It works fine showing on the screen.
How to convert it to PDF format using code and showing on the screen?
Jul 13, 2010 04:54 PM|sansan|LINK
If you have the report without any parameters,
you can just do this:
public void GetReport()
CrystalReport1 cr = new CrystalReport1();
MemoryStream mem = (MemoryStream)cr.ExportToStream(ExportFormatType.PortableDocFormat);
Response.Buffer = true;
Response.ContentType = "application/pdf";
catch (Exception ex)
this is for a simple report.
if you have parameters and sub reports, then you may have to loop through the parameter collection and apply default values.
you have to supply login information for sub reports if any
Jul 14, 2010 09:55 AM|aspfun|LINK
I use VB code but I got error below said that CrystalReport1 is not defined. (I created CrystalReport1)
Dim cr As New CrystalReport1()
Jul 14, 2010 10:29 AM|sansan|LINK
CrystalReport1 is the name of the crystal report.
Put the name of your report there
should work fine
Jul 14, 2010 10:44 AM|aspfun|LINK
I did put the name of my report there but got "not defined" error.
How to add my report as the member of class?