Silverlight DataGrid: Export to excel or csv

后端 未结 9 2216
野趣味
野趣味 2020-12-13 10:17

Is there a way I can export my Silverlight DataGrid data to excel or csv?

I searched the web but can\'t find any examples!

Thanks a lot

9条回答
  •  佛祖请我去吃肉
    2020-12-13 10:53

    Check Ryan's solution out. Looks good, can't vouch for it though because I just found it. Ryan does what DLL above requested.

    http://www.rshelby.com/post/exporting-data-from-silverilght-datagrid-to-excel.aspx

    David in Dakota's solution above looks a little easier to implement, and there is always the redirect to a classic asp.net page with a data grid on it and the content type set to excel, but then you have more code to support and that way may not work for out of browser solutions that are offline (actually won't work).

    Anyway, this is a common task. I hope some folks here or at Microsoft come up with a Mort plug and play solution :)

    I found an extension method for CVS export from a Silverlight datagrid-

    http://www.codeproject.com/KB/silverlight/SilverlightDataGridExport.aspx

    It has the potential to be plug and play, but I had to tweek it just a little bit to get it to work with datagrids with item datasources (see comments in the post). Someone brighter and more experienced than myself should be able to tweak to perfection. Check it out, it should get you close to what you need.

提交回复
热议问题