Hello:
I’m sending a Crystal Reports’s report to Word, but a dialog box is opening where user is asking if wish open/save file.
I’d like avoid this dialog emerges and report be displayed directly in screen as user would press open button.
I’m attaching code I’m using:
string ExportPath = sRuta + "CrystalReport1" + ".doc";
crvReportes.ReportSource = cr;
CrystalDecisions.Shared.DiskFileDestinationOptions DiskOpts = new CrystalDecisions.Shared.DiskFileDestinationOptions();
cr.ExportOptions.ExportDestinationType = CrystalDecisions.Shared.ExportDestinationType.DiskFile;
cr.ExportOptions.ExportFormatType = CrystalDecisions.Shared.ExportFormatType.WordForWindows;
DiskOpts.DiskFileName = ExportPath;
cr.ExportOptions.DestinationOptions = DiskOpts;
cr.Export();
Response.ClearContent();
Response.ClearHeaders();
Response.ContentType = "application/msword";
Response.WriteFile(ExportPath);
Response.Flush();
Response.Close();
System.IO.File.Delete(ExportPath);
Where crvReportes is my CrystalReportViewer y cr is my ReoprtDocument
I’ll thank your help.
A.L.
Enter your message below
Sign in or Join us (it's free).