angrymeeow
Programmer
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
[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] [cat2] [cat2]](/data/assets/smilies/cat2.gif)
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] [cat2] [cat2]](/data/assets/smilies/cat2.gif)