Microsoft Office Tutorials and References
In Depth Information
EWA and API Working Together
// Error handler
catch (Exception exc)
// Error handler
When you have finished entering the code, save the application. Then build the application to confirm
that there are no errors.
Creating the Web Page
If you do not already have a SharePoint Web Part Page where you can load the web application, follow
these steps to create one:
Use the browser to navigate to the site where you want to create the web page.
Select Site Actions
On the create.aspx page, click Web Part Page. When the New Web Part Page is displayed,
provide a name for the page. For this example, name the page testPage2.aspx . Choose the Full
Page template and click the Create button. The testpage2.aspx page loads in Design mode.
Click the Add a Web Part button and add two Web Parts: Page Viewer Web Part and Excel
Web Access Web Part. The testpage2.aspx page now contains both Web Parts and remains in
Configure the EWA to load a default workbook by opening the Properties task pane. To do this,
click the edit link on the EWA Web Part and click Modify Shared Web Part. In the Workbook
input field, enter the full path to a workbook from a trusted location. Click OK to apply the
change. The workbook loads in the EWA.
Obtain the EWA Web Part ID by right-clicking the page above the Full Page label near the top of
the page. Select View Source from the IE context menu, and then search the source for the ID
of the EWA Web Part. The ID will be similar to WebPartWPQ4.
Update the Default.aspx code to use the EWA Web Part ID for your web page. Search for
‘WebPartWPQ4’ and replace the string with the EWA Web Part ID.
Configuring the Page Viewer Web Part
Next, you configure the Page Viewer to load the Web application. Follow these steps:
Click the Edit link on the Page Viewer Web Part.
In the Link field, enter the URL of the application. This is the same value that you used
when you created the web application in Visual Studio (for example, http://TheExcelServer/
Click OK in the Properties pane to apply the changes to the Web Part and close the pane. The
web page reloads, no longer in Design mode.