Last active
March 27, 2018 02:34
-
-
Save jipyua/bdb339e4be5d7ef71182b879111be43f to your computer and use it in GitHub Desktop.
This is the script to test the setting changed event - Shared with Script Lab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: XL createWorkbook | |
description: This is the script to test the setting changed event | |
author: jipyua | |
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.run(function (ctx) { | |
var wb = ctx.application.createWorkbook(base64).open(); | |
return ctx.sync().then(function () { | |
console.log("Success"); | |
}); | |
}).catch(function (error) { | |
console.log("Fail"); | |
}); | |
} | |
language: typescript | |
template: | |
content: "<form>\n\t<button id=\"createxl\">Create presentation</button>\n\t<p>Select document to be inserted <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: |4- | |
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