Exporting Data to Microsoft Excel
By default, users can export to Microsoft Office Excel any list of data that appears in a screen. Then, users can create charts, reports, and PivotTables by using features in Excel. If you want to prevent users from exporting data to Excel, you can disable this feature in the Screen Designer of your project.
Note
Export to Excel functionality is only enabled for desktop applications. Web applications cannot access local resources or files due to security restrictions.
Exporting Data
Users of your application can export data to Excel by clicking the Export to Excel button that appears in a screen. Users can only export collections of data. Therefore, the Export to Excel button appears above collection of data records only (For example: A customer List or products GridView). The Export to Excel button does not appear above areas in the screen that display the details of a data item.
When users click Export to Excel, the application opens an Excel worksheet, and then populates the worksheet by using data from the collection that appears on the screen. Data that does not appear on the screen is not exported. If paging is enabled for the collection, and you want to export additional rows of data, you must increase the number of rows shown in a page or disable paging entirely before you export the data. For more information, see How to: Design a Silverlight Screen by Using the Screen Designer.
After users export data to Excel, they can create reports, charts, and PivotTables by using features in Excel. For more information, see Creating Reports, Charts, and PivotTables.
Disabling the Ability to Export Data
If your users do not have Excel installed on their computers, or you do not want users to export some collection of data, you can disable this feature.
Note
If a user clicks Export to Excel, but Excel is not installed on their computer, an error message will appear.
In the Screen Designer, select any DataGrid or List. Then, in the Properties window, select the Disable exporting data to Excel checkbox. You must disable the ability to export data for each DataGrid or List control individually. In the running application, the Export to Excel button will not appear above any collection to which you have applied the Disable exporting data to Excel setting.
See Also
Tasks
Walkthrough: Consuming LightSwitch Services in Excel Using PowerPivot