导出设置

这些示例展示了如何设置ActiveReportsJS Viewer组件的导出UI。 该代码使用Viewer组件的availableExports属性指定可用的导出类型,并使用ExportsSettings选项预设输出文档的设置。 尝试将报告导出为支持的格式之一,并观察输出文档中的应用设置。 请访问 导出设置页 查看更多的信息。 向下滚动页面查看代码。

<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <title>ActiveReportsJS sample</title> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <link href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&display=swap" rel="stylesheet" /> <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous" /> <link rel="stylesheet" href="https://cdn.materialdesignicons.com/2.8.94/css/materialdesignicons.min.css" /> <script src="/activereportsjs/demos/arjs/dist/ar-js-core.js"></script> <script src="/activereportsjs/demos/arjs/dist/ar-js-viewer.js"></script> <script src="/activereportsjs/demos/arjs/dist/ar-js-pdf.js"></script> <script src="/activereportsjs/demos/arjs/dist/ar-js-xlsx.js"></script> <script src="/activereportsjs/demos/arjs/dist/ar-js-html.js"></script> <script src="/activereportsjs/demos/arjs-localization/dist/ar-js-locales.js"></script> <script src="$DEMOROOT$/lib/purejs/license.js"></script> <link rel="stylesheet" type="text/css" href="/activereportsjs/demos/arjs/styles/ar-js-ui.css" /> <link rel="stylesheet" type="text/css" href="/activereportsjs/demos/arjs/styles/ar-js-viewer.css" /> <style> #viewer-host { margin: 0 auto; width: 100%; height: 500px; } </style> </head> <body> <div class="container-fluid"> <div class="form-group mb-3 mt-3"> <div> <label> 请选择导出的格式: </label> </div> <div class="form-check form-check-inline"> <input class="form-check-input" type="checkbox" id="checkboxPdf" value="pdf" checked onchange="setAvailableExports()" /> <label class="form-check-label" for="inlineCheckbox1">PDF</label> </div> <div class="form-check form-check-inline"> <input class="form-check-input" type="checkbox" id="checkboxHtml" value="html" checked onchange="setAvailableExports()" /> <label class="form-check-label" for="inlineCheckbox2">HTML</label> </div> <div class="form-check form-check-inline"> <input class="form-check-input" type="checkbox" id="checkboxXLSX" value="xlsx" checked onchange="setAvailableExports()" /> <label class="form-check-label" for="inlineCheckbox3">XLSX</label> </div> </div> </div> <div id="viewer-host"></div> <script> const exportsSettings = { pdf: { title: "ActiveReportsJS Sample", author: "GrapeCity", subject: "Web Reporting", keywords: "reporting, sample", userPassword: "pwd", ownerPassword: "ownerPwd", printing: "none", copying: false, modifying: false, annotating: false, contentAccessibility: false, documentAssembly: false, pdfVersion: "1.7", autoPrint: true, filename: "ActiveReportsJS-Sample.pdf", }, xlsx: { creator: "GrapeCity", size: "Letter", orientation: "Landscape", sheetName: "Report", password: "pwd", filename: "ActiveReportsJS-Sample.xlsx", }, html: { title: "ActiveReportsJS Sample", filename: "ActiveReportsJS-Sample.html", autoPrint: true, multiPage: true, embedImages: "external", outputType: "html", }, }; const viewer = new ActiveReports.Viewer("#viewer-host", { ExportsSettings: exportsSettings, language: "zh", }); viewer.sidebarVisible = true; viewer.open( "/activereportsjs/demos/resource/reports/Frontstore.rdlx-json" ); const checkboxesIds = ["checkboxPdf", "checkboxHtml", "checkboxXLSX"]; function setAvailableExports() { const availableExports = []; checkboxesIds.forEach(function (checkBoxId) { const checkBox = document.getElementById(checkBoxId); if (checkBox && checkBox.checked) { availableExports.push(checkBox.value); } }); viewer.availableExports = availableExports; } setAvailableExports(); </script> </body> </html>