Last active
August 29, 2015 14:21
-
-
Save beckettkev/b97e73dbc878b03a8a98 to your computer and use it in GitHub Desktop.
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
/* | |
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