Is there a built-in field attribute in the FileHelper library that will add a title bar to the final generated CSV?
I have Googled and have not found much information about this. I currently have this:
DelimitedFileEngine _engine = new DelimitedFileEngine(T); _engine.WriteStream (HttpContext.Current.Response.Output, dataSource, int.MaxValue);
It works, but without a title.
I am thinking of having an attribute of type FieldTitleAttribute and using it as a column heading.
So my question is at what point do I check the attribute and insert the header columns? Has anyone done something like this before?
I would like the headers to insert and use custom text different from the actual field name, just using the attribute for each member of the object:
[FieldTitleAttribute("Custom Title")] private string Name
and, possibly, the ability to tell the engine to insert a title when creating it.
Therefore, when WriteStream or WriteString , a header row will be inserted using custom headers.
I found a couple of events for DelimitedFileEngine, but not the best way to determine if the current record is the first row and how to insert the row before that.
c # csv filehelpers
Heinnge Oct 20 2018-10-10T00: 00Z
source share