Microsoft Office Tutorials and References
In Depth Information
You can use the Excel Services Excel Web Access Web Part in one of two ways: embedded in a
SharePoint page or by leveraging the built-in xlviewer.aspx solution. When the EWA is embedded, the
configurable Web Part properties are exposed through SharePoint’s Modify Shared Web Part interface.
The xlviewer.aspx solution doesn’t expose the Web Part properties through any user interface. The
xlviewer.aspx page isn’t coded to accept URL parameters for the properties either.
This section demonstrates the steps necessary to create a solution based on the functionality provided by
the xlviewer.aspx method of using the EWA. The more popular EWA properties are explained and code
examples are provided for setting the EWA properties.
There are a couple of scenarios in Excel Services where the xlviewer.aspx is used to render workbooks with
the EWA. A SharePoint document library functionality called View in Web Browser uses xlviewer.aspx to
render the workbook. Each EWA Web Part in a SharePoint page has a clickable title that loads the
workbook using xlviewer.aspx. By default, xlviewer.aspx takes over the entire browser window and renders the
workbook using the EWA. This provides better viewing of the workbook, with less scrolling, because
the EWA isn’t sharing screen space with other SharePoint components. You can also construct links in
web pages or in e-mail messages that use xlviewer.aspx to load a workbook (for example, http://
Creating a customized version of xlviewer.aspx is a straightforward operation. In the following section,
you create a copy of xlviewer.aspx and add code for setting EWA properties.
You could apply the changes described here directly to xlviewer.aspx, which would affect the behavior for
all consumers of xlviewer.aspx. This may be your intention. However, for this example solution, you
modify a copy of xlviewer.aspx.
Setting New Defaults and URL Parameters
Follow these steps to create a customized version of xlviewer.aspx:
1. Locate the xlviewer.aspx file at C:\Program Files\Common Files\Microsoft Shared\web server
extensions\12\TEMPLATE\LAYOUTS. Make a copy of xlviewer.aspx and keep it in the same
directory. For this solution, name the copy xlEwa.aspx .
2. Open xlEwa.aspx in a text editor (such as Notepad) or, if you like extra bells and whistles,
use a program like Visual Studio. Locate the following statement in the file and change the
AutoEventWireUp attribute’s value to true:
<%@ Page language=”C#” Codebehind=”XlViewer.aspx.cs” AutoEventWireup=”true”