showPrintPreview (src);
src. Data for preview window.
The showPrintPreview method shows workbook preview window.
To execute the example, the page must contain the WorkbookBox component named workbookBox (see Example of Creating the WorkbookBox Component), and the following code must be added in the handler that processes document opening:
//Get component for displaying menu of the Ribbon type var ribbonView = workbookBox.getRibbonView(); var showPrintPreviewButt = new PP.Ui.Button({ ParentNode: document.body, //DOM parent node Content: "Show Print Preview", //Text Click: PP.Delegate(onClickShowPrintPreview) }); function onClickShowPrintPreview() { //Get data source for time series analysis workbook var source = ribbonView.getSource(); //Call the method for report export to XLS, PDF and other formats. tsService.Export(source, { format: PP.Mb.ExportFormat.PDF, IsPrintRequest: True }, _onPrintPreviewReady); } function _onPrintPreviewReady(sender, args) { //Get data export URL var url = metabase.getExportUrl(); //Get data from server response text var expData = JSON.parse(args.ResponseText).GetEaxMdResult.meta.exportData; var id = expData.storeId.id; var format = expData.format; if (url.indexOf("?") == -1) url += "?"; else url += "&"; //Get display object identifier var src = url + "key=" + id + "&format=" + format + "&d=" + (new Date().getTime()) + "&inline=True"; //Output workbook preview window ribbonView.showPrintPreview(src); }
After executing the example the Preview button is placed on the HTML page. Clicking this button opens the window that contains workbook preview.
See also: