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. convert html to csvexport to CSV

convert html to csvexport to CSV

Scheduled Pinned Locked Moved ASP.NET
htmlhelpannouncement
2 Posts 2 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.
  • M Offline
    M Offline
    Member 3879881
    wrote on last edited by
    #1

    Hi Guys i have a data format like this format...,

    Head1

    Head2

    Head3

    some value

    value1

    value2

    value3

    value1

    value2

    value3

    value1

    value2

    value3

    some value dasfs

    value1

    value2

    value3

    value1

    value2

    value3

    Now i want to export the values to .CSV format..., In lower version of .CSV(2000) its showing datas properly..., the same thing if i open in 2007 CSV format..., i am getting the records how i mentioned in above(table) the sme way i am getting (i.e) with table..., this is my code: string strData = ".......

    //the above table format i given here Response.Write(strData); byte[] data = ASCIIEncoding.ASCII.GetBytes(strData); Response.Clear(); Response.ContentType = "text/csv"; Response.AddHeader("content-disposition", "attachment;filename=" + _UserID + "Stock" + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + ".csv"); Response.BinaryWrite(data); Response.End(); plz help me regards this..., Thanks & Regards, Member 3879881, please don't forget to vote on the post

    T 1 Reply Last reply
    0
    • M Member 3879881

      Hi Guys i have a data format like this format...,

      Head1

      Head2

      Head3

      some value

      value1

      value2

      value3

      value1

      value2

      value3

      value1

      value2

      value3

      some value dasfs

      value1

      value2

      value3

      value1

      value2

      value3

      Now i want to export the values to .CSV format..., In lower version of .CSV(2000) its showing datas properly..., the same thing if i open in 2007 CSV format..., i am getting the records how i mentioned in above(table) the sme way i am getting (i.e) with table..., this is my code: string strData = ".......

      //the above table format i given here Response.Write(strData); byte[] data = ASCIIEncoding.ASCII.GetBytes(strData); Response.Clear(); Response.ContentType = "text/csv"; Response.AddHeader("content-disposition", "attachment;filename=" + _UserID + "Stock" + DateTime.Now.Second.ToString() + DateTime.Now.Millisecond.ToString() + ".csv"); Response.BinaryWrite(data); Response.End(); plz help me regards this..., Thanks & Regards, Member 3879881, please don't forget to vote on the post

      T Offline
      T Offline
      T M Gray
      wrote on last edited by
      #2

      I don't see where you said what the actual problem is. There is no such thing as CSV2000 or CSV2007. CSV stands for comma separated values. It is a text file. HTML is not CSV. Telling an application you are giving it CSV data when you are actually giving it HTML would definitely lead to unpredictable results. If you want to save as CSV then do the parsing to actual produce CSV. Load your HTML into either an HTMLTable object or an XMLDocument object and create a proper CSV. Since you are not using the proper quotes for your attributes it may be a little tricky

      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