Excel Export Plus is a SharePoint solution that demonstrates a usage of the OfficeWriter API in SharePoint. This solution adds a new ribbon button to SharePoint lists, allowing you to export the list data to a pre-formatted Excel template that can be designed in Excel or automatically generated by Excel Export Plus. |
Whereas using the out-of-the-box SharePoint export-to-Excel feature allows only for raw, unformatted data dumps, using OfficeWriter and Excel Export Plus supports:
After you install and configure Excel Export Plus, you will find a button in the ribbon of your list that exports the list data into a pre-defined template in Excel. The "List to Excel" ribbon button below is an example of Excel Export Plus. You can customize the button text based on your requirements.
Excel Export Plus uses the OfficeWriter API under SharePoint's hood to merge SharePoint list item data into a Excel workbook. For example, say you have a list like this one, with CompanyName, Address, City, State, Zip, ContactName, and PhoneNumber columns:
You could design a template like this in Excel. Put anything you want into the Excel workbook document, and type specially formatted data markers that correspond to the names of the columns in the list. These data markers specify where the list data will be merged into the template.
When you choose to export the list data by clicking the ribbon button, Excel Export Plus pulls the values from the list and then uses OfficeWriter to open the template file, replace the data markers with actual data, and stream the populated workbook to the browser:
You can install OfficeWriter and Excel Export Plus and use it as-is, customize the code to fit your own needs, or simply use it as an educational tool to better understand the capabilities of OfficeWriter.
The first step is to install OfficeWriter and Excel Export Plus on the SharePoint web farm.
The following is a list of prerequisites for this solution installer.
To run the installer:
All installation steps are assumed to occur on the machine where the SharePoint web app resides.
Once the Installation steps are complete, the solution will appear as a SharePoint Feature that can be activated and managed by a site administrator. Follow these steps to configure Excel Export Plus:
#Browse to the SharePoint site in which you want to use this solution.
In this step, you will enable Excel Export Plus on a specific list, select a template file that it will export the list's contents to, and define the text for the context menu item.
Here is an example the configuration screen for the sample list described above:
Now that you have your list associated with a template file in the document library, you can edit the template and add more formatting, content, or merge fields that correspond to column names in the list.
For more information about Excel template files, see here:
http://wiki.softartisans.com/display/EW8/How+to+Use+Templates