MacD Level: Big Cheese
 Registered: 06-01-2004 Posts: 19
|
Re: How Do i generate a CSV file from ASP.NET
A .CSV file is a comma seperated file so when writing to the file just make sure that you use a comma "," to seperate the output values so that they will be written to different cells.
Below are the steps you can follow:
1. create an object of File type
2. make your file name extension be .csv
Lets say you want to write 3 Headers in the file in the first line do it as follows :
fs.Write(heading1)
fs.Write(",") // comma for separating headers to be in
// different cells of the file
fs.Write(heading2)
fs.Write(",")
fs.WriteLn(heading3)
Where :
fs = Object of type File
heading1-3 = text to be written as headers
I hope this may assist you.
|