Exporting data (Data Table) to Excel

V

Vlash

Hi,

I develop a windows application in C# and have a form with Data Table (Data
Grid). I need to export it to Excel to specific path (selected by the user in
SaveFileDialog). Can anybody tell me how I do it?
Code example will be more than welcomed.

Thank you.
 
R

Ronald Dodge

You may want to have your C# program save the data as a CSV (Preferred) or
Text (Tab delimited) file, which then Excel can take it from there and
convert it into an Excel spreadsheet.

Provided you know VBA in Excel, you can use the Object Browser within the
VBA side of Excel to view the various constants listed within the
"XlFileFormat" Class. Of course, for your C# program, you may have a
different set of constants for the File Type argument, which is the second
argument of the Dialogs(xlDialogSaveAs) object.
 
R

Ronald Dodge

Good thing in there though barely even looked over it. However, from the
little glance that I took a look at, I'm not so sure about the ADO and MS
Query stuff due to the memory leak issues that I have ran into using those
methods, which then caused my system to have to be rebooted so much sooner.

However, when you posted the link, you needed to add the "/en-us" at the
end, otherwise, it just posts as an invalid page with the MS's support
website area.

http://support.microsoft.com/kb/306023/en-us
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top