Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Export to CrysatlReport Format

Status
Not open for further replies.

angrymeeow

Programmer
Oct 17, 2002
24
0
0
ZA
Hi all, I'm using Crystal Reports for .NET 1.1 in a web project.

What I need to do is export a subreport to CrystalReport format. I can do this successfully to pdf but when I export to a report I can't open the report. I get an "Invalid TLV Record" error.

Has anyone ever managed to export a report to CrystalReport format?

Here is my code

Code:
Response.ClearHeaders();
Response.ClearContent();

ReportDocument sub = rpt.OpenSubreport("BankSubmissionSummary");

ExportOptions expOptions = sub.ExportOptions;
				
Response.ContentType = "application/rpt";
Response.AddHeader("Content-Disposition", "attachment; filename=test.rpt" );

expOptions.ExportFormatType = ExportFormatType.CrystalReport;
ExportRequestContext req = new ExportRequestContext();
req.ExportInfo = expOptions;

MemoryStream s = (MemoryStream)sub.FormatEngine.ExportToStream(req);
Stream outstream = Response.OutputStream;
				
byte[] readBuf = new byte[4096];
int bytes = 0;
do
{
  bytes = s.Read( readBuf, 0, readBuf.Length );
  outstream.Write( readBuf, 0, bytes );
}
while( bytes > 0 ); 

Response.End();

[red]G[/red][purple]r[/purple][blue]r[/blue][green]r[/green][yellow].[/yellow][white]..[/white][yellow]m[/yellow][green]e[/green][blue]e[/blue][purple]o[/purple][red]w[/red] [cat2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top