Results 1 to 4 of 4

Thread: Converting the web application code in windows form application code

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2010
    Posts
    29

    Converting the web application code in windows form application code

    Good morning everybody...

    the following code works well in .aspx page that is in
    web application..
    now the same thing i want to do in windows form application.. can anybody help me..

    The code is for without saving the pdf file take a print..
    it works well in .aspx page
    ReportDocument cryRpt = new ReportDocument();
    cryRpt.Load("E:\\Report1\\over\\CrystalReport1.rpt");
    ReportDocument cryRpt = new ReportDocument();
    cryRpt.Load("E:\\Report1\\over\\CrystalReport1.rpt");
    MemoryStream oStream; // using System.IO
    oStream = (MemoryStream)
    cryRpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
    Response.Clear();
    Response.Buffer = true;
    Response.ContentType = "application/pdf";
    Response.BinaryWrite(oStream.ToArray());
    Response.End();

    In windows form the Response .clear or response.buffer is not supported
    error is missing namespace or directive is displaying...

  2. #2
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Converting the web application code in windows form application code

    You nee to open the pdf using System.IO.Process.Start("Pdf filename"). This will open the pdf in default editor
    Please mark you thread resolved using the Thread Tools as shown

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Sep 2010
    Posts
    29

    Re: Converting the web application code in windows form application code

    hi
    i've tryed the following code but it is saving the pdf file..
    i dont want to save the file instead i want to export the pdf file
    and take the print and when i close it should not be saved in memory..
    There's one option using buffer but how to use this in windows form
    i dont know..
    the following is my code which saves the pdf file.

    private void Form1_Load(object sender, EventArgs e)
    {
    ReportDocument cryRpt = new ReportDocument();
    cryRpt.Load("E:\\Report1\\over\\CrystalReport1.rpt");
    ExportOptions CrExportOptions ;
    DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions();
    PdfRtfWordFormatOptions CrFormatTypeOptions = new pdfRtfWordFormatOptions(); cryRpt.ExportToStream(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
    CrDiskFileDestinationOptions.DiskFileName = "C:\\Documents and Settings\\DEV002\\Desktop\\aa.pdf";
    CrExportOptions = cryRpt.ExportOptions;
    {
    CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
    CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
    CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions;
    CrExportOptions.FormatOptions = CrFormatTypeOptions;
    }
    cryRpt.Export();
    }

    but i want to export without saving the file..

  4. #4
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: Converting the web application code in windows form application code

    Try the ReportDocument.PrintToPrinter method

    http://msdn.microsoft.com/en-us/library/ms226031%28VS.90%29.aspx
    Please mark you thread resolved using the Thread Tools as shown

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width