Reputation: 127
I have DataContext in my windows phone application.
I want to generate a excel spreadsheet or csv file from the dataset.
Is it possible to create a csv or excel spreadsheet from the Windows Phone application ?
Upvotes: 1
Views: 184
Reputation: 8147
A CSV file is simply a text file with fields separated by commas. They can store arbitrary data. You can either use a library to catch edge cases or simply write your values into a text file separated by commas if you want something quick and dirty.
A typical CSV file would look like this:
"Name","Age","Gender"
"Jenny",21,"Female"
"Bloggs, Fred",25,"Male"
Note, that strings are often stored in double-quotes and this is to help with things like "Bloggs, Fred" that contains a comma. This is where using a library comes in handy but you can hand crank yourself if you want.
Re Excel - assuming your CSV was well formed it would open it just fine. That doesn't mean it is an Excel file but just a file that Excel understands. Writing Excel files (depending on version of Excel) is more complicated but possible.
Upvotes: 1