So I just installed CsvHelper because that's the one I heard was the better one to use.
I looked at the documentation and tried to figure out how to accompish what I wanted which is to create 1 column and fill it with values that are seperated with commas (,).
And then a cell under that one that would have the corresponding value so like this
ID,Type,Name,Description,Image
11,Variation,MyCoolProduct,A super cool product, Image1 | Image2
I dont want different columns to the side I want to have 1 column with a string inside that is formated like that.
This is what I did, which didnt work because you cant even open the file because you get a SYLK format issue
var records = new List<Columns>
{
new Columns {ID = 12, Type = "Variation", Description = "Simple product with different colors",
Images = "Image1 | Image 2", Price = 19.99d}
};
using (StreamWriter sw = new StreamWriter("Testfile.csv"))
{
var writer = new CsvWriter(sw);
writer.WriteRecords(records);
}
UPDATE
I've mapped it like this now, how do i write it out to a textfile?
public sealed class MyClassMap : ClassMap<Columns>
{
public MyClassMap()
{
Map(m => m.ID);
}
}