How to create MX Excel file from DataTable?
-
Hi, I need to create MS Excel file from DataTable in ASP.NET application. I don't need "SaveAs" dialog. Just create a file and save them to some folder. I've searched the internet and found some examples how to do that by using Microsoft Excel Interop library. But, I can't use Excel Interop library. Is there any other way to do it? Thank you in advance. Goran
-
Hi, I need to create MS Excel file from DataTable in ASP.NET application. I don't need "SaveAs" dialog. Just create a file and save them to some folder. I've searched the internet and found some examples how to do that by using Microsoft Excel Interop library. But, I can't use Excel Interop library. Is there any other way to do it? Thank you in advance. Goran
Take a look at Export DataTable to Excel with Formatting in C#. It should be a good starting point.
-
Hi, I need to create MS Excel file from DataTable in ASP.NET application. I don't need "SaveAs" dialog. Just create a file and save them to some folder. I've searched the internet and found some examples how to do that by using Microsoft Excel Interop library. But, I can't use Excel Interop library. Is there any other way to do it? Thank you in advance. Goran
If you don't need special formatting or formulas then just drop the file as CSV. Excel will open CSV files with or without column names as the first row. Your question doesn't include any requirements that aren't met by a CSV file. And yes, I agree, using the Office Interop stuff is horrifying - I wrote an article about it years ago, and I still get questions on that article today. It's pretty tricky.
-
If you don't need special formatting or formulas then just drop the file as CSV. Excel will open CSV files with or without column names as the first row. Your question doesn't include any requirements that aren't met by a CSV file. And yes, I agree, using the Office Interop stuff is horrifying - I wrote an article about it years ago, and I still get questions on that article today. It's pretty tricky.
Yes. We can create CSV file instead of XLS. But, there's only one thing that could be a little bit undesired - wizard that opens CSV file. I'm not sure, but I think MS Excel cannot open CSV file directly without using wizard. Is that right?
-
Yes. We can create CSV file instead of XLS. But, there's only one thing that could be a little bit undesired - wizard that opens CSV file. I'm not sure, but I think MS Excel cannot open CSV file directly without using wizard. Is that right?
Nope. Excel can open a CSV file directly. :-D
-
Nope. Excel can open a CSV file directly. :-D
Right, and any of those security dialogs that come up - the users don't even notice that stuff. Even if the conversion wizard does come up, the users probably won't care. They complete those tasks by rote - it's a bad habit really, but it's not a huge interruption to their day. Which is not to say you shouldn't worry about it - it's a legitimate concern, but it's not as big a problem as we sometimes think.