Microsoft Office Tutorials and References
In Depth Information
EWA and API Working Together
// Put results in input control
document.getElementById(‘_sessionInfo_xl’).value =
// Not an event to be caught here
// — >
<div id=”service” style=”behavior:url(”
onresult=”onWSGetResult();” />
<input type=”text” style=”width:150px” id=”_sessionId_xl” />
<input type=”button” style=”width:100px” value=”Get Session”
onclick=”document.getElementById(‘_sessionId_xl’).value =
(EwaGetSessionId(‘WebPartWPQ4’));” />
<br />
<input type=”text” style=”width:30px” id=”_reload_xl” />
<input type=”button” value=”Reload EWA”
onclick=”document.getElementById(‘_reload_xl’).value =
(EwaReloadWorkbook(‘WebPartWPQ4’));” />
<br />
<input type=”text” style=”width:150px” id=”_cellFocus_xl” />
<input type=”button” style=”width:100px” value=”Selected Cell”
onclick=”document.getElementById(‘_cellFocus_xl’).value =
(getHighlightedCellA1Reference(‘WebPartWPQ4’));” />
<br />
<input type=”text” style=”width:160px” id=”_sessionInfo_xl” />
<input TYPE=”button” VALUE=”Session Info” NAME=”GetSessionInfo”
onclick=”callGetSessionInfo()” />
Click Save to keep the code. 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.
Solution Functionality
The web page you created loads the workbook in the EWA and the Content Editor renders the custom
code. Figure 14-1 shows what the page looks like when the custom code is executed.
Note the following:
Get Session button — Clicking this button makes a call to the EWA EwaGetSessionId function,
which returns the sessionId of the currently loaded workbook.
Reload EWA button — Clicking this button makes a call to the EWA EwaReloadWorkbook function,
which returns a TRUE or FALSE status to reflect whether or not the EWA reload call was successful.
The function reloads the original workbook, so any private state that existed previously is lost.
Search JabSto ::

Custom Search