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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. HTML to Excel from ASP.Net

HTML to Excel from ASP.Net

Scheduled Pinned Locked Moved ASP.NET
csharphtmlasp-nethelp
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.
  • B Offline
    B Offline
    Biju Sam
    wrote on last edited by
    #1

    Hi I have a trange requirement which is as follows: I have a HTML file with records which looks like a List View in ASP.NET. Please note that it is like a List view and not like a Datagrid. But this is inside a single table. I have to take this data and export it to excel in a DataGrid type of view. One more problem i see in this HTML file is, say suppose there are 200 records which is displayed in that List view, if the first record has values, the second might have 12. So the resulting excel sheet should have columns with maximum colums what the List view had. HTML looks something this: lt;table class='basic' width='100%' border='1' cellspacing='0'><tr class='header'><td valign='top' colspan=2 width='15%' class='sectionHeader'>Properties</td><tr><td valign='top' width='15%'>SI_ID</td><td valign='top'>15314</td></tr><tr><td valign='top' width='15%'>SI_NAME</td><td valign='top'>B&amp;C Share Top Dealers by Fund</td></tr><tr><td valign='top' width='15%'>SI_OWNER</td><td valign='top'>sweekev-a</td></tr><tr><td valign='top' width='15%'>SI_PARENT_FOLDER</td><td valign='top'>6294</td></tr><tr><td valign='top' width='15%'>SI_UPDATE_TS</td><td valign='top'>2/13/2008 4:59:01 PM</td></tr><tr><td valign='top' width='15%'>SI_CREATION_TIME</td><td valign='top'>2/13/2008 4:59:01 PM</td></tr><tr><td valign='top' width='15%'>SI_KIND</td><td valign='top'>Excel</td></tr><tr><td valign='top' width='15%'>SI_PROGID</td><td valign='top'>CrystalEnterprise.Excel</td></tr><tr><td valign='top' width='15%'>SI_FILES</td><td valign='top'><table class='basic' width='100%' border='1' cellspacing='0'><tr><td valign='top' width='15%'>SI_PATH</td><td

    C A 2 Replies Last reply
    0
    • B Biju Sam

      Hi I have a trange requirement which is as follows: I have a HTML file with records which looks like a List View in ASP.NET. Please note that it is like a List view and not like a Datagrid. But this is inside a single table. I have to take this data and export it to excel in a DataGrid type of view. One more problem i see in this HTML file is, say suppose there are 200 records which is displayed in that List view, if the first record has values, the second might have 12. So the resulting excel sheet should have columns with maximum colums what the List view had. HTML looks something this: lt;table class='basic' width='100%' border='1' cellspacing='0'><tr class='header'><td valign='top' colspan=2 width='15%' class='sectionHeader'>Properties</td><tr><td valign='top' width='15%'>SI_ID</td><td valign='top'>15314</td></tr><tr><td valign='top' width='15%'>SI_NAME</td><td valign='top'>B&amp;C Share Top Dealers by Fund</td></tr><tr><td valign='top' width='15%'>SI_OWNER</td><td valign='top'>sweekev-a</td></tr><tr><td valign='top' width='15%'>SI_PARENT_FOLDER</td><td valign='top'>6294</td></tr><tr><td valign='top' width='15%'>SI_UPDATE_TS</td><td valign='top'>2/13/2008 4:59:01 PM</td></tr><tr><td valign='top' width='15%'>SI_CREATION_TIME</td><td valign='top'>2/13/2008 4:59:01 PM</td></tr><tr><td valign='top' width='15%'>SI_KIND</td><td valign='top'>Excel</td></tr><tr><td valign='top' width='15%'>SI_PROGID</td><td valign='top'>CrystalEnterprise.Excel</td></tr><tr><td valign='top' width='15%'>SI_FILES</td><td valign='top'><table class='basic' width='100%' border='1' cellspacing='0'><tr><td valign='top' width='15%'>SI_PATH</td><td

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      Biju Sam wrote:

      export it to excel in a DataGrid type of view.

      So, you need to take your data source, use it to create an Excel file, then send it to the client.

      Christian Graus Please read this if you don't understand the answer I've given you "also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )

      1 Reply Last reply
      0
      • B Biju Sam

        Hi I have a trange requirement which is as follows: I have a HTML file with records which looks like a List View in ASP.NET. Please note that it is like a List view and not like a Datagrid. But this is inside a single table. I have to take this data and export it to excel in a DataGrid type of view. One more problem i see in this HTML file is, say suppose there are 200 records which is displayed in that List view, if the first record has values, the second might have 12. So the resulting excel sheet should have columns with maximum colums what the List view had. HTML looks something this: lt;table class='basic' width='100%' border='1' cellspacing='0'><tr class='header'><td valign='top' colspan=2 width='15%' class='sectionHeader'>Properties</td><tr><td valign='top' width='15%'>SI_ID</td><td valign='top'>15314</td></tr><tr><td valign='top' width='15%'>SI_NAME</td><td valign='top'>B&amp;C Share Top Dealers by Fund</td></tr><tr><td valign='top' width='15%'>SI_OWNER</td><td valign='top'>sweekev-a</td></tr><tr><td valign='top' width='15%'>SI_PARENT_FOLDER</td><td valign='top'>6294</td></tr><tr><td valign='top' width='15%'>SI_UPDATE_TS</td><td valign='top'>2/13/2008 4:59:01 PM</td></tr><tr><td valign='top' width='15%'>SI_CREATION_TIME</td><td valign='top'>2/13/2008 4:59:01 PM</td></tr><tr><td valign='top' width='15%'>SI_KIND</td><td valign='top'>Excel</td></tr><tr><td valign='top' width='15%'>SI_PROGID</td><td valign='top'>CrystalEnterprise.Excel</td></tr><tr><td valign='top' width='15%'>SI_FILES</td><td valign='top'><table class='basic' width='100%' border='1' cellspacing='0'><tr><td valign='top' width='15%'>SI_PATH</td><td

        A Offline
        A Offline
        Arindam Tewary
        wrote on last edited by
        #3

        Hi, Though I didnt get your problem very nicely .. But still I would try to help you out from what I understood .. 1.Use some Regular Expression to extract all data( I suppose in side each cell of your HTML table is your data right?), which you need to show in each cell of your excel. 2.using Extracted data create an XML. 3.Export the XML values to datagrid or Excel what ever you required.

        Thanks, Arindam D Tewary

        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