I have recently updated the OfficeJS.dialogs to version 1.0.8. I have also updated the Node Package Manager version as well. You can get it by running the following command in the VSCode Terminal Window:
npm install officejs.dialogs
With this latest version comes a few bug fixes, some cleanup of the code, cleaner JSDoc documentation and a PrintPreview dialog. The PrintPreview started out as a proof of concept but it actually works for me – in the browser anyway. I am not sure how well it will work in any of the full clients as I have not tested it there yet. If anyone has a chance to test it, please let me know if you encounter any issues.
Here is a sample of the PrintPreview dialog:
Here is some code to implement it:
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
// 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"); | |
}); | |
}); | |
}); |