您好,请问您使用的是 MVC+JSViewer 吗?如果是的话,可以使用以下方法
方法1:在报表渲染完后直接执行导出
- var viewer = GrapeCity.ActiveReports.JSViewer.create({
- element: '#viewerContainer',
- reportID: 'RDL报表.rdlx;', //报表名称
- //availableExports: ['Xml', 'Pdf'],//导出的方式
- reportService: {},
- renderMode: 'Galley',//画廊模式
- // other properties
- documentLoaded: () => {
-
- viewer.export('Pdf', null, true, { Title: '1997 Annual Report' })
复制代码
方法2:
初始化Viewer,但设置绑定viewer 的div 宽度和高度为0 使得客户不可见,然后调用Viewer.export()方法
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8" />
- <title></title>
- <link rel="stylesheet" href="https://cdn.materialdesignicons.com/2.4.85/css/materialdesignicons.min.css">
- <link rel="stylesheet" href="https://fonts.cat.net/css?family=Open+Sans:400,300,600,700" type="text/css">
- <link rel="stylesheet" href="scripts/jsViewer.min.css" type="text/css">
- <script src="scripts/jsViewer.min.js"></script>
- </head>
- <body>
- <div id="viewerContainer" style="width:0px;height"0px">Loading Report</div>
- </body>
- </html>
- <script type="text/javascript">
- var viewer = GrapeCity.ActiveReports.JSViewer.create({
- element: '#viewerContainer',
- reportID: 'ReportName.rdlx', // the id of the report to display
- });
复制代码
|