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