Created
June 15, 2020 19:55
-
-
Save davecra/88e8eb57481da9d8edd2b8123a238221 to your computer and use it in GitHub Desktop.
This is the code from a Task Pane Add-in that sends a message to a Content Add-in via a CustomXMLPart
This file contains hidden or 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
const ns = "http://pfe.microsoft.com/excelpoc/1.0"; | |
const xml = "<message xmlns='http://pfe.microsoft.com/excelpoc/1.0'>" + | |
"<sentby>[who]</sentby>" + | |
"<info>[data]</info>" + | |
"</message>"; | |
const from_tp = "TASKPANE ADD-IN"; | |
function sendMessage() { | |
Excel.run(function(context) { | |
var data = xml.replace("[who]", from_tp).replace("[data]", "This message is coming from the taskpane."); | |
const customXmlPart = context.workbook.customXmlParts.add(data); | |
customXmlPart.load(); | |
return context.sync().then(); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment