本帖最后由 Lenka.Guo 于 2022-2-22 10:12 编辑
ActiveReports 16 为WebViewer及JSViewer提供了丰富的导出能力,并支持配置各个文件类型的导出设置。
自定义xls 导出设置:
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <link rel='shortcut icon' type='image/x-icon' href='favicon.ico' />
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
- <meta name="theme-color" content="#000000">
- <title>JS Viewer</title>
- <link href="jsViewer.min.css" rel="stylesheet">
- <link href="index.css" rel="stylesheet">
- </head>
- <body onload="loadViewer()">
- <div style="width: 100%">
- <div id="viewerContainer"></div>
- </div>
- <script type="text/javascript" src="jsViewer.min.js"></script>
- <script type="text/javascript">
- let viewer;
- function loadViewer() {
- viewer = GrapeCity.ActiveReports.JSViewer.create({
- element: '#viewerContainer',
- defaultExportSettings: {
-
- xls: {
- /* only rdlx */
- EnableToggles: { value: true },
- LayoutMode: { value: 'Galley' },
- RightToLeft: { value: true },
- /* only rpx */
- FileFormat: { value: 'Xls95' },
- AutoRowHeight: { value: true },
- DisplayGridLines: { value: true },
- Pagination: { value: false },
- /* both (rdlx and rpx) */
- MultiSheet: { value: false },
- SheetName: { value: 'Sheet_xls' },
- UseDefaultPalette: { value: true },
- Orientation: { value: 'Landscape' },
- PaperSize: { value: 'A5' },
- Password: { value: '123456' },
- ProtectedBy: { value: 'USER' },
- ReadOnlyRecommended: { value: true },
- WritePassword: { value: '123456' },
- FileName: { value: "ar16" }
- },
- }
- });
- viewer.openReport("DemoReport.rdlx");
- }
- </script>
- </body>
- </html>
-
复制代码 自定义.xlsx 导出设置:
自定义导出doc格式设置
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <link rel='shortcut icon' type='image/x-icon' href='favicon.ico' />
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
- <meta name="theme-color" content="#000000">
- <title>JS Viewer</title>
- <link href="jsViewer.min.css" rel="stylesheet">
- <link href="index.css" rel="stylesheet">
- </head>
- <body onload="loadViewer()">
- <div style="width: 100%">
- <div id="viewerContainer"></div>
- </div>
- <script type="text/javascript" src="jsViewer.min.js"></script>
- <script type="text/javascript">
- let viewer;
- function loadViewer() {
- viewer = GrapeCity.ActiveReports.JSViewer.create({
- element: '#viewerContainer',
- defaultExportSettings: {
-
- doc: {
- Author: { value: 'USER', visible: true },
- BaseHref: { value: 'www.com' },
- Generator: { value: 'Created by USER' },
- PageHeight: { value: '10' },
- PageWidth: { value: '5' },
- Title: { value: 'TITLE_01' },
- FileName: { value: 'ar16_doc', visible: true }
- },
- }
- });
- viewer.openReport("DemoReport.rdlx");
- }
- </script>
- </body>
- </html>
-
复制代码
自定义导出Docx设置:
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <link rel='shortcut icon' type='image/x-icon' href='favicon.ico' />
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
- <meta name="theme-color" content="#000000">
- <title>JS Viewer</title>
- <link href="jsViewer.min.css" rel="stylesheet">
- <link href="index.css" rel="stylesheet">
- </head>
- <body onload="loadViewer()">
- <div style="width: 100%">
- <div id="viewerContainer"></div>
- </div>
- <script type="text/javascript" src="jsViewer.min.js"></script>
- <script type="text/javascript">
- let viewer;
- function loadViewer() {
- viewer = GrapeCity.ActiveReports.JSViewer.create({
- element: '#viewerContainer',
- defaultExportSettings: {
- docx: {
- Author: { value: 'USER' },
- CompanyName: { value: 'USER_COMPANY' },
- DocumentCompatibilityVersion: { value: 'Word2010' },
- DpiX: { value: 80 },
- DpiY: { value: 80 },
- Title: { value: 'TITLE_01' },
- TOCAutoUpdate: { value: true },
- Orientation: { value: 'Portrait' },
- PaperSize: { value: 'B4' },
- Password: { value: '123456' },
- ReadOnlyRecommended: { value: true },
- WritePassword: { value: '123456' },
- FileName: { value: 'ar16_doc' }
- },
- }
- });
- viewer.openReport("DemoReport.rdlx");
- }
- </script>
- </body>
- </html>
-
复制代码
自定义导出PDF 设置
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="utf-8">
- <link rel='shortcut icon' type='image/x-icon' href='favicon.ico' />
- <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
- <meta name="theme-color" content="#000000">
- <title>JS Viewer</title>
- <link href="jsViewer.min.css" rel="stylesheet">
- <link href="index.css" rel="stylesheet">
- </head>
- <body onload="loadViewer()">
- <div style="width: 100%">
- <div id="viewerContainer"></div>
- </div>
- <script type="text/javascript" src="jsViewer.min.js"></script>
- <script type="text/javascript">
- let viewer;
- function loadViewer() {
- viewer = GrapeCity.ActiveReports.JSViewer.create({
- element: '#viewerContainer',
- defaultExportSettings: {
- pdf: {
- /*only for rpx*/
- ConvertMetaToPng: { value: true },
- ExportBookmarks: { value: false },
- ImageInterpolation: { value: 'Auto' },
- ImageQuality: { value: 'Highest' },
- /*both (rdlx and rpx)*/
- Title: { value: 'Document' },
- Author: { value: 'USER' },
- Subject: { value: 'PDF' },
- Keywords: { value: 'PDF export' },
- Application: { value: 'AR16' },
- EmbedFonts: { value: 'All' },
- Version: { value: 'PDF-1.5' },
- UserPassword: { value: 'user_pwd' },
- OwnerPassword: { value: 'owner_pwd' },
- Encrypt: { value: true },
- FileName: { value: 'ar16_pdf', visible: true }
- },
- }
- });
- viewer.openReport("DemoReport.rdlx");
- }
- </script>
- </body>
- </html>
-
复制代码
|
|