can someone please tell me or point me in the right direction regarding how to save a LINQ table to an excel spreadsheet?
Thanks!
Mr Cricket
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Generally, there are two methods to Excel:
UI layer
A lot of UI controls, say Grids, such as XtraGrid (DevExpress.com), can show Linq result (actually you have to call IQueryable.ToList() at first) and then export what you see into excel, pdf, csv and other formats.
The advantage is you may adjust the UI represenation of the Linq data before you export it.
The disadvantage is that it is interactive, so user activity is involved.
Data Layer
You may write lines of code to export the data into MS excel directly. It should be very easy if you know the API of MS API. But if you want to make the sheet beautiful, you may need a lot of code. Or you may create an MS Excel template manually and show the data by the help of the template.
The advantage is the speed and no user is involved.
The disadvantage is that it is hard to make the export beautiful or conveniently. Especially when you offer this function to end users.