Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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.

Posted

Hello:

Surely I need to be more explicit.

I'm trying to export a report from a CrystalReportViewer to a location within client machine, I write it therein and then I want display it imto web page, I want avoid dialgog box asking if user want open or save file. I want that it be displayed into a web form without such a dialog, if instead Word document I export it to .pdf format it is displayed directly without such a dialog.

How can I achieve it in Word?

A.L.

Posted

Code I�m using is:

 

Response.ClearContent();

Response.ClearHeaders();

Response.Clear();

Response.ContentType = "application/msword";

Response.Charset = "";

 

Response.AddHeader("Content-disposition", "inline; filename=ExportPath");

Response.AddHeader("Content-Length", sFileLength);

 

Response.WriteFile(ExportPath);

Response.Flush();

Response.Close();

System.IO.File.Delete(ExportPath);

 

If file to display was not MS-Word neither MS-Excel, as a PDF file, then dialog box is not showed.

 

How can I in MS files to such dialog not be showed?

 

A.L.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...