I tried to export my C # list to a Csv file. Everything is set up well. But the fact is that the field separator is not working properly. its display, like, my line with "at the end (ex: 0000324df"). Here is my controller code.
IEnumerable stockexpo = stockexp; // Assign value MemoryStream output = new MemoryStream(); StreamWriter writer = new StreamWriter(output, Encoding.UTF8); writer.Write("ItemNo,"); writer.Write("Repeat Count"); writer.WriteLine(); foreach (StockResult order in stockexpo) { writer.Write(String.Format("{0:d}", order.ItemNumber)); writer.Write("\""); writer.Write(","); writer.Write("\""); writer.Write(order.Count); writer.Write("\""); writer.Write(","); writer.WriteLine(); } writer.Flush(); output.Position = 0; return File(output, "text/comma-separated-values", "stockexp.csv");
I need to know how I can appropriately separate field values. Anyone can help me with this.
source share