Microsoft Office Tutorials and References
In Depth Information
EWA and API Working Together
<asp:Label ID=”_saveworkbookLabel_xl” runat=”server” Text=”Workbook Name:”
<asp:TextBox ID=”_fileNameTextBox_xl” runat=”server” Width=”200px”></asp:TextBox>
<asp:Button ID=”_getWorkbookButton_xl” runat=”server”
OnClick=”_getWorkbookButton_xl_Click” Text=”GetWorkbook” Width=”130px” />
<br /><br />
<input type=”button” style=”width:160px” value=”Reload EWA Workbook”
onclick=”‘WebPartWPQ4’);” />
<br /><br />
<input type=”button” style=”width:160px” value=”Get Selected EWA Cell”
onclick=”getElementById(‘_cellWithFocusTextBox_xl’).value =
(‘WebPartWPQ4’));” />
<asp:TextBox ID=”_cellWithFocusTextBox_xl” runat=”server”
Adding the Default.aspx.cs Code
Use the Solution Explorer in Visual Studio to open Default.aspx.cs. Enter the following code in
Default.aspx.cs. You can replace the entire contents of Default.aspx.cs with the code provided here.
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.Office.Excel.Server.WebServices;
using System.Windows.Forms;
using System.Web.Services.Protocols;
using System.IO;
public partial class _Default : System.Web.UI.Page
ExcelService xlEcsApi = new ExcelService();
Status[] xlStatus;
protected void Page_Load(object sender, EventArgs e)
protected void _getApiVersionButton_xl_Click(object sender, EventArgs e)
_getApiVersionTextBox_xl.Text = xlEcsApi.GetApiVersion(out xlStatus);
if (xlStatus != null)
for (int i = 0; i < xlStatus.Length; i++)
// Status handler
Search JabSto ::

Custom Search