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. Embed Excel sheet in web page

Embed Excel sheet in web page

Scheduled Pinned Locked Moved ASP.NET
question
4 Posts 4 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
    samerh
    wrote on last edited by
    #1

    Hi all, how can i embed excel sheet with everything it holds (pivot table, charts ...) in an aspx page. any ideas, thanks

    M L 2 Replies Last reply
    0
    • S samerh

      Hi all, how can i embed excel sheet with everything it holds (pivot table, charts ...) in an aspx page. any ideas, thanks

      M Offline
      M Offline
      Manas Bhardwaj
      wrote on last edited by
      #2

      You can just create a web page (e.g. WebForm1.aspx) in asp.net and put the following code in Page_Load event in code behind page

      Response.ContentType = "application/vnd.ms-excel";

      string sFile = Server.MapPath("MyExcel.xls");

      FileStream fs = new FileStream(sFile, FileMode.Open, FileAccess.Read);

      byte[] b = new byte[(int)fs.Length];

      fs.Read(b, 0, (int)fs.Length);

      fs.Close();

      Response.Clear();

      Response.BinaryWrite(b);

      Response.End();

      Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

      P 1 Reply Last reply
      0
      • M Manas Bhardwaj

        You can just create a web page (e.g. WebForm1.aspx) in asp.net and put the following code in Page_Load event in code behind page

        Response.ContentType = "application/vnd.ms-excel";

        string sFile = Server.MapPath("MyExcel.xls");

        FileStream fs = new FileStream(sFile, FileMode.Open, FileAccess.Read);

        byte[] b = new byte[(int)fs.Length];

        fs.Read(b, 0, (int)fs.Length);

        fs.Close();

        Response.Clear();

        Response.BinaryWrite(b);

        Response.End();

        Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.

        P Offline
        P Offline
        padmanabhan N
        wrote on last edited by
        #3

        This will create a new excel sheet. But samerh want the excel inside the aspx page like the images and gif files.

        Padmanabhan My Articles: Articles[^] My latest Article: Word Automation[^]

        1 Reply Last reply
        0
        • S samerh

          Hi all, how can i embed excel sheet with everything it holds (pivot table, charts ...) in an aspx page. any ideas, thanks

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Check it out http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/e475fa75-03e5-4cbf-8d0b-f44acaaa97dc[^]

          Regards Aman Bhullar www.arlivesupport.com[^]

          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