Skip to content

Instantly share code, notes, and snippets.

@jipyua
Created March 19, 2019 05:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jipyua/e49d9fe8d9dc7f152e3f73413e3d8e60 to your computer and use it in GitHub Desktop.
Save jipyua/e49d9fe8d9dc7f152e3f73413e3d8e60 to your computer and use it in GitHub Desktop.
This is the script to test the setting changed event
name: XL createWorkbook
description: This is the script to test the setting changed event
host: EXCEL
api_set: {}
script:
content: |
$("#createxl").click(function() {
createXLDocument();
});
function createXLDocument() {
var file = document.getElementById("myFile").files[0];
if (file == null) {
createXL("");
return;
}
var reader = new FileReader();
reader.onload = (function(theFile) {
return function(e) {
var startIndex = e.target.result.indexOf("base64,");
var mybase64 = e.target.result.substr(startIndex + 7, e.target.result.length);
createXL(mybase64);
};
})(file);
reader.readAsDataURL(file);
}
function createXL(base64) {
Excel.createWorkbook(base64);
}
language: typescript
template:
content: "<form>\n\t<button id=\"createxl\">Create Workbook</button>\n\t<p>Select workbook to be created <br>\n\t<input id=\"myFile\" name=\"myFile\" type=\"file\">\n</form>"
language: html
style:
content: |-
/* Your style goes here */
https://appsforoffice.microsoft.com/lib/beta/hosted/office.js
https://appsforoffice.microsoft.com/lib/beta/hosted/office.d.ts
office-ui-fabric-js@1.4.0/dist/css/fabric.min.css
office-ui-fabric-js@1.4.0/dist/css/fabric.components.min.css
core-js@2.4.1/client/core.min.js
@types/core-js
@microsoft/office-js-helpers@0.7.4/dist/office.helpers.min.js
@microsoft/office-js-helpers@0.7.4/dist/office.helpers.d.ts
jquery@3.1.1
@types/jquery
language: css
libraries: |2-
https://appsforoffice.microsoft.com/lib/beta/hosted/office.js
https://appsforoffice.microsoft.com/lib/beta/hosted/office.d.ts
office-ui-fabric-js@1.4.0/dist/css/fabric.min.css
office-ui-fabric-js@1.4.0/dist/css/fabric.components.min.css
core-js@2.4.1/client/core.min.js
@types/core-js
@microsoft/office-js-helpers@0.7.4/dist/office.helpers.min.js
@microsoft/office-js-helpers@0.7.4/dist/office.helpers.d.ts
jquery@3.1.1
@types/jquery
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment