本帖最后由 williamluo 于 2017-11-1 23:14 编辑
只需在documentLoaded事件中调用 viewer.print();即可:
function ExportReport(serverUrl, token, reportName, divId) {
var viewer;
viewer = GrapeCity.ActiveReports.Viewer({
element: divId, //'#viewerContainer',
reportService: {
url: serverUrl + '/api/',
// securityToken: token
securityToken: '$anonymous'
, resourceHandler: serverUrl + '/cache/'
},
report: {
id: reportName
, parameters: [ { name: 'P1', value: getQueryString('P1') }, { name: 'P2', value: getQueryString('P2') }]
//, parameters: [{ name: 'MultiValueParameter1', multivalue: true, values: null }, { name: 'Parameter1', value: null }, { name: 'Parameter2', value: null }]
},
uiType: 'desktop',
localeUri: 'zh.txt',
documentLoaded: function () {
//viewer.export("Image", showImage, true, { ImageType: 'png' });
viewer.print();
}
});
}
效果请参考:
http://ars.grapecity.com.cn/webapp/viewlabel.html
|