How Avoid Dialog Box Open/Save Files

csharp Mexico
  • 16 years ago

    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.


  • 16 years ago

    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.

  • 16 years ago

    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.

  • 15 years ago

    hi,
    i have seen ur question. I am also looking for the answer. Please mail me if u have got the solution (exporting crystal report to word  without save dialog box) I am in urgent need.
    Thanking you.
    Siva.
    kssiva_s@yahoo.com

  • 15 years ago
    Thanks for ur code. It works well. it Really help me to export the crystal report file to pdf without save dialog box.
    Please don't stop posting ur code.
    Bye.
    With Regards,
    Siva
  • 15 years ago

    kssiva, I strongly suggest that you edit your post and remove your e-mail address, or at least edit it so it is not usable by spambots.  If you leave your real e-mail address in so public a place you will soon be spammed to death.  A generally accepted substitute that is still human-readable but fools spammers is something like:


    myname@mydomain.removeifnotspamming.com

  • 14 years ago

    hi,
    i have seen ur question. I am also looking for the answer. Please mail me if u have got the solution (exporting crystal report to word  without save dialog box) I am in urgent need.
    Thanking you.



    bando

    daniele.bandini@gmail.removethis.com

  • 14 years ago

    If I understand correctly (I'm sorry if this question was answered in a private message/email) then you should set the SuppressDialog property toTrue.



  • 14 years ago

    Hi,

    Could you please send me the solution for this problem.

    Thanks,

    Deepa

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“Linux is only free if your time has no value” - Jamie Zawinski