Skip to content

Instantly share code, notes, and snippets.

@davecra
Created September 13, 2017 14:46
Show Gist options
  • Save davecra/9ea434bf3e2b651a5f222456ddf3019b to your computer and use it in GitHub Desktop.
Save davecra/9ea434bf3e2b651a5f222456ddf3019b to your computer and use it in GitHub Desktop.
Demonstrates how to use the PrintPreview dialog in OfficeJS.dialogs, version 1.0.8
// this example takes the currently composed email message in Outlook,
// grabs its body HTML and then displays it in the Print Preview dialog.
var mailItem = Office.cast.item.toItemCompose(Office.context.mailbox.item);
mailItem.saveAsync(function(asyncResult) {
var id = asyncResult.id;
mailItem.body.getAsync(Office.CoercionType.Html, { asyncContext: { var3: 1, var4: 2 } }, function(result) {
var html = result.value;
PrintPreview.Show(html, function() {
Alert.Show("Print cancelled");
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment