Section 8.4. Creating Web Parts from Excel


8.4. Creating Web Parts from Excel

You can create custom Spreadsheet web parts from Excel 2003 using the Excel Office Web Part Add-In. Excel web parts can include data bindings, XML Maps, formatting, and complex formulas that are difficult to create from the Spreadsheet web part's browser interface.

The add-in doesn't create a new web part assembly, but rather customizes the existing Spreadsheet web part by adding a new web part description (. dwp ) to the site gallery. Before you begin, download and install the components listed in Table 8-5 from http://www.microsoft.com/downloads.

Table 8-5. Downloads for Office web parts

Download

Install on

Used to

Office Web Parts ( ststpkpl.exe )

Server

Provide Spreadsheet, charting, and pivot table web parts.

Office Web Components ( owc11.exe )

Clients

Provides interactive features from web parts for Office 2003 users and read-only capability for non-Office 2003 clients.

Excel Office Web Part Add-in ( Spreadsheet Add-In.EXE )

Development machine

Create custom Spreadsheet web parts from within Excel 2003.


The add-in is currently in beta testing. By the time a release version of the add-in is available, some of these procedures and descriptions may have changed.


Installing the add-in appends the Create Add-In menu to Excel. To create a web part from an existing spreadsheet:

  1. Open the workbook containing the spreadsheet in Excel 2003.

  2. Choose Create Add-In. Excel displays the dialog in Figure 8-10.

  3. Enter the name of the SharePoint server you wish to deploy the web part to and choose Get Live DocLib Information. The add-in populates the drop-down lists with lists of the libraries to which you can deploy the web part.

  4. Select a library to deploy to and clear the "Create, if doclibs don't exist" option.

  5. Choose Web Part DWP to add a title and description of the web part.

  6. Choose Create to create and deploy the web part. The add-in displays Figure 8-11.

The Document Library name in Figure 8-10 must match the folder name of the library. If you get an error writing files in Step 6, check the actual address of the library. In this case, the Samples library was actually in the Samples1 folder.


animal 8-10. Creating a spreadsheet web part from Excel

animal 8-11. The add-in displays the publishing status after you choose Create

To use the new web part from a web part page:

  1. Navigate to the list where the web part description (. dwp ) is published and select Explorer View.

  2. Copy the . dwp file to a folder on your local computer. This step is necessary because you can't upload a . dwp file from a document library into SharePoint.

  3. Create a new web part page and choose Modify Shared Page Add Web Parts Import. SharePoint displays the Web Part task pane.

  4. Choose Upload. SharePoint uploads the web part to the web part page gallery.

  5. Drag the web part onto a web part zone. SharePoint adds the web part to the page shown in Figure 8-12.

animal 8-12. Importing a web part generated by the Excel add-in

Importing the web part makes it available on that one page. To make the web part available to all web part pages on the site, import the web part description into the site gallery:

  1. Choose Site Settings Go to Site Administration Go to Top-level Site Administration Manage Web Part Gallery.

  2. Browse, select the web parts . dwp file, enter a group name to help categorize the part, and choose OK.
  3. Verify that the web part works by choosing the Type icon next to the new web part in the gallery list. SharePoint displays a preview of the web part.

Since the add-in generated web part description references a solution file stored in a library, the new web part will only work within the site that contains the library. If you try to use the web part outside of that site, you'll see an error like the one in Figure 8-13.

You may also bump up against the web part property size limits when working with Spreadsheet web parts. The Loan Calculator sample saves quite a bit of data; if you enter values on the page in Figure 8-12, then go to another page you'll see the warning in Figure 8-14.

animal 8-13. You get an error if you use the web part outside its site

animal 8-14. Warning generated by web part trying to save too much data

To fix that, you must increase the WebPartLimits PropertySize attribute in the server's Web.config file, as shown here:

 <WebPartLimits MaxZoneParts="50" PropertySize="  2048576  " /> 

Of course, increasing this limit requires additional storage on the server and may affect performance. Be sure to test your settings before deploying them to the production server.



Essential SharePoint
Essential SharePoint 2007: A Practical Guide for Users, Administrators and Developers
ISBN: 0596514077
EAN: 2147483647
Year: 2005
Pages: 153
Authors: Jeff Webb

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net