Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. displaying report in excel

displaying report in excel

Scheduled Pinned Locked Moved ASP.NET
csharptutorial
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shabi uz zaman
    wrote on last edited by
    #1

    how to display the crystel report in excel. i want to show the dataset in ms excel.by using c#

    J P 2 Replies Last reply
    0
    • S shabi uz zaman

      how to display the crystel report in excel. i want to show the dataset in ms excel.by using c#

      J Offline
      J Offline
      John ph
      wrote on last edited by
      #2

      You can use the below written procedure to display the crystal report in excel format in a web form. You have to pass the instance of the crystal report and the dataset as parameter to this procedure.

      private void subDisplayReport(ReportClass rptObject, DataSet lDataSet)
      {
      rptObject.SetDataSource(lDataSet);
      rptObject.ExportOptions.FormatOptions = new ExcelFormatOptions();
      rptObject.ExportOptions.ExportFormatType = ExportFormatType.Excel;
      ExportRequestContext req = new ExportRequestContext();
      req.ExportInfo = rptObject.ExportOptions;
      System.IO.Stream st;
      st = rptObject.FormatEngine.ExportToStream(req);
      byte[] b = new byte[(int)st.Length + 1];
      st.Read(b, 0, (int)st.Length);
      Response.ClearContent();
      Response.ClearHeaders();
      Response.ContentType = "application/xls";
      Response.AddHeader("content-disposition", "inline; filename=MyReport.xls");
      Response.BinaryWrite(b);
      Response.End();
      }

      Procedure written by John(J O N) in VB.NET on 19/10/2005. Code converted to C#

      - Regards -
         JON


      Life is not measured by the amount of breaths we take, but by the moments that take our breath away.


      1 Reply Last reply
      0
      • S shabi uz zaman

        how to display the crystel report in excel. i want to show the dataset in ms excel.by using c#

        P Offline
        P Offline
        Paul Conrad
        wrote on last edited by
        #3

        What does this have to do with ASP.NET?

        "Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups