I'm using the FileHelpers library for a C# .net project. All is working ok except I need to have the generated CSV savable via a button click.
So the user clicks a button and they get a prompt to save the file. I know Filehelpers has a WriteStream option but their own documentation shows only an example of WriteFile. I don't know if WriteStream is what's needed but I think it is.
Anyone know if it's possible to have the CSV file saved directly to the client rather than to the server hard drive?
Thanks.
UPDATE WITH MORE DETAIL:
I'll try to give more detail to help clarify what it is I'm trying to achieve. I don't want to save any file on the server. I am using FileHelpers to generate a record and I want to try and use their WriteStream method to write that record as a CSV directly to their browser; but the example they provide doesn't actually use that method at all, strangely.
Here's the link to their method:
http://www.filehelpers.com/FileHelpers.FileHelperEngine.WriteStream_overload_2.html
And here's the method in question.
public void WriteStream(
TextWriter writer,
IEnumerable records,
int maxRecords
);
I can easily save the file to the server but don't want to as I've no need for it and want to get the client to save it directly to their own machine.
It may be that I have to go through the normal route to achieve this but I saw the WriteStream method and thought maybe FileHelpers facilitated a nice clean way of achieving the same result.
Hope this is clearer.