Create a gist now

Instantly share code, notes, and snippets.

Embed
/*
Using the previous example, you can store the final Open XML snippet in a data attribute (e.g. data-base64) using jQuery
$this.data('base64', data)
and if you want to get the data again, use the following code:
$this.data('base64')
Where $this is a localised pointer to the image tag in jQuery. This code usually runs from a click event.
*/
if (!$this.hasClass('local')) {
//do what we did before (but remember to apply the local css class once it's finished...
} else {
//previously clicked on the image
Office.context.document.setSelectedDataAsync(
imageOXmlTemplate.replace(
'{Base64}',
$this.data('base64')
),
{ coercionType: "ooxml" },
function (asyncResult) {
if (asyncResult.status == "failed") {
//Again. Do something!
} else {
$this.removeClass('busy');
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment