Embed excel file using Javascript (or some other method)
In a project, I want the learner to use Excel for some exercises. I think it's possible to publish an Excel file to a website, then grab both the embed syntax as well as the javascript code that will display that excel file with most of its functionality intact. I've managed to get both these sets of code for a test Excel file using the Microsoft WebApp capability.
Here's the Javascript code for this sample file:
<div id="myExcelDiv" style="width: 402px; height: 346px"></div>
<script type="text/javascript" src="http://r.office.microsoft.com/r/rlidExcelWLJS?v=1&kip=1"></script>
<script type="text/javascript">
/*
* This code uses the Microsoft Office Excel Javascript object model to programmatically insert the
* Excel Web App into a div with id=myExcelDiv. The full API is documented at
* http://msdn.microsoft.com/en-US/library/hh315812.aspx. There you can find out how to programmatically get
* values from your Excel file and how to use the rest of the object model.
*/
// Use this file token to reference Monthly-college-budget1.xlsx in Excel's APIs
var fileToken = "SDF7DD05E3DFEB03A5!116/-586305900215860315/t=0&s=0&v=!ADQIX85gdpgH9M4";
// run the Excel load handler on page load
if (window.attachEvent) {
window.attachEvent("onload", loadEwaOnPageLoad);
} else {
window.addEventListener("DOMContentLoaded", loadEwaOnPageLoad, false);
}
function loadEwaOnPageLoad() {
var props = {
uiOptions: {
selectedCell: "'Monthly College Budget'!N1"
},
interactivityOptions: { }
};
Ewa.EwaControl.loadEwaAsync(fileToken, "myExcelDiv", props, onEwaLoaded);
}
function onEwaLoaded(result) {
/*
* Add code here to interact with the embedded Excel web app.
* Find out more at http://msdn.microsoft.com/en-US/library/hh315812.aspx.
*/
}
</script>
I tried dropping this code into the script window for a button action in Captivate 8, then previewed using F12, but there was no response when I clicked the button. 9Wouldn't that have been great if it was that simple?)
I'm guessing I need to invoke the new Captivate 8 common JavaScript API, and maybe more.
Can anyone advise on a way to do this?
Thanks!
