Fix Bug 42160

This commit is contained in:
Julia Radzhabova 2019-07-23 15:07:51 +03:00
parent f97967a60c
commit bf92472a4a
8 changed files with 29 additions and 9 deletions

View file

@ -44,7 +44,7 @@
newDocumentPage.focus(); newDocumentPage.focus();
} }
} }
, dialogPrint: function(url) { , dialogPrint: function(url, api) {
$('#id-print-frame').remove(); $('#id-print-frame').remove();
if ( !!url ) { if ( !!url ) {
@ -59,10 +59,14 @@
document.body.appendChild(iframePrint); document.body.appendChild(iframePrint);
iframePrint.onload = function () { iframePrint.onload = function () {
try {
iframePrint.contentWindow.focus(); iframePrint.contentWindow.focus();
iframePrint.contentWindow.print(); iframePrint.contentWindow.print();
iframePrint.contentWindow.blur(); iframePrint.contentWindow.blur();
window.focus(); window.focus();
} catch (e) {
api.asc_DownloadAs(Asc.c_oAscFileType.PDF);
}
}; };
iframePrint.src = url; iframePrint.src = url;

View file

@ -208,7 +208,7 @@ DE.ApplicationController = new(function(){
} }
function onPrintUrl(url) { function onPrintUrl(url) {
common.utils.dialogPrint(url); common.utils.dialogPrint(url, api);
} }
function hidePreloader() { function hidePreloader() {

View file

@ -2090,10 +2090,14 @@ define([
this.iframePrint.style.bottom = "0"; this.iframePrint.style.bottom = "0";
document.body.appendChild(this.iframePrint); document.body.appendChild(this.iframePrint);
this.iframePrint.onload = function() { this.iframePrint.onload = function() {
try {
me.iframePrint.contentWindow.focus(); me.iframePrint.contentWindow.focus();
me.iframePrint.contentWindow.print(); me.iframePrint.contentWindow.print();
me.iframePrint.contentWindow.blur(); me.iframePrint.contentWindow.blur();
window.focus(); window.focus();
} catch (e) {
me.api.asc_DownloadAs(Asc.c_oAscFileType.PDF);
}
}; };
} }
if (url) this.iframePrint.src = url; if (url) this.iframePrint.src = url;

View file

@ -205,7 +205,7 @@ PE.ApplicationController = new(function(){
} }
function onPrintUrl(url) { function onPrintUrl(url) {
common.utils.dialogPrint(url); common.utils.dialogPrint(url, api);
} }
function hidePreloader() { function hidePreloader() {

View file

@ -1778,10 +1778,14 @@ define([
this.iframePrint.style.bottom = "0"; this.iframePrint.style.bottom = "0";
document.body.appendChild(this.iframePrint); document.body.appendChild(this.iframePrint);
this.iframePrint.onload = function() { this.iframePrint.onload = function() {
try {
me.iframePrint.contentWindow.focus(); me.iframePrint.contentWindow.focus();
me.iframePrint.contentWindow.print(); me.iframePrint.contentWindow.print();
me.iframePrint.contentWindow.blur(); me.iframePrint.contentWindow.blur();
window.focus(); window.focus();
} catch (e) {
me.api.asc_DownloadAs(Asc.c_oAscFileType.PDF);
}
}; };
} }
if (url) this.iframePrint.src = url; if (url) this.iframePrint.src = url;

View file

@ -160,7 +160,7 @@ SSE.ApplicationController = new(function(){
} }
function onPrintUrl(url) { function onPrintUrl(url) {
common.utils.dialogPrint(url); common.utils.dialogPrint(url, api);
} }
function hidePreloader() { function hidePreloader() {

View file

@ -2015,10 +2015,14 @@ define([
this.iframePrint.style.bottom = "0"; this.iframePrint.style.bottom = "0";
document.body.appendChild(this.iframePrint); document.body.appendChild(this.iframePrint);
this.iframePrint.onload = function() { this.iframePrint.onload = function() {
try {
me.iframePrint.contentWindow.focus(); me.iframePrint.contentWindow.focus();
me.iframePrint.contentWindow.print(); me.iframePrint.contentWindow.print();
me.iframePrint.contentWindow.blur(); me.iframePrint.contentWindow.blur();
window.focus(); window.focus();
} catch (e) {
me.api.asc_DownloadAs(Asc.c_oAscFileType.PDF, false, me.getApplication().getController('Print').getPrintParams());
}
}; };
} }
if (url) this.iframePrint.src = url; if (url) this.iframePrint.src = url;

View file

@ -349,6 +349,10 @@ define([
} }
}, },
getPrintParams: function() {
return this.adjPrintParams;
},
warnCheckMargings: 'Margins are incorrect', warnCheckMargings: 'Margins are incorrect',
strAllSheets: 'All Sheets', strAllSheets: 'All Sheets',
textWarning: 'Warning', textWarning: 'Warning',