Microsoft Office Tutorials and References
In Depth Information
EWA and API Working Together
Creating the C# Web Application Project
Follow these steps to launch Visual Studio on the MOSS server and create the C# Web Site application:
1.
Start Visual Studio.
2.
Select File
New
Web Site to open the New Web Site dialog box.
3.
In the Templates frame, select ASP.NET Web Site. Set the Location to HTTP and the Language
to Visual C#.
4.
Enter the path for the web application in the form of http://<server>/_layouts/
<applicationName>. For example, http://TheExcelServer/_layouts/EwaCustApp
creates the application in C:\Program Files\Common Files\Microsoft Shared\web
server extensions\12\TEMPLATE\LAYOUTS.
5.
Select OK to create the application. The New Web Site dialog box closes and Visual Studio
opens the EwaCustApp solution with Default.aspx displayed. The Solution Explorer shows
that Default.aspx.cs has been created as well.
Adding References
Follow these steps to add references:
1.
Select Website
Add Reference to open the Add Reference dialog box.
2.
On the .NET tab of the Add Reference dialog box, select each of the following components and
then click OK to add them as references to the application:
Windows SharePoint Services component to add the Microsoft.SharePoint.dll
Excel web services component to add the Microsoft.Office.Excel.Server.WebServices.dll
System.Windows.Forms to add the System.Windows.Forms.dll
Adding the Default.aspx Code
Enter the following code between the <div> and </div> tags in Default.aspx:
<asp:Button ID=”_getApiVersionButton_xl” runat=”server”
OnClick=”_getApiVersionButton_xl_Click” Text=”GetAPIVersion” Width=”130px” />
<asp:TextBox ID=”_getApiVersionTextBox_xl” runat=”server”
Width=”160px”></asp:TextBox>
<br /><br />
<input type=”button” style=”width:140px” value=”Get EWA Session ID”
onclick=”getElementById(‘_sessionIdTextBox_xl’).value =
(window.top.EwaGetSessionId(‘WebPartWPQ4’));” />
<asp:TextBox ID=”_sessionIdTextBox_xl” runat=”server” Width=”305px”></asp:TextBox>
<br /><br />
<asp:ListBox ID=”_workbookTypeListBox_xl” runat=”server” Height=”35px”
Width=”148px”>
<asp:ListItem Value=”FullWorkBook”></asp:ListItem>
<asp:ListItem Value=”FullSnapshot”></asp:ListItem>
<asp:ListItem Value=”PubishedItemSnapshot”></asp:ListItem>
</asp:ListBox>
<br />
Search JabSto ::




Custom Search