您好!
如果没有打印按钮,打印按钮是可以自己添加的!
- <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Asp.net_Html5.WebForm1" %>
- <!DOCTYPE html>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head runat="server">
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title></title>
- <link href="css/theme-cosmo.css" rel="stylesheet"/>
- <link href="css/site.css" rel="stylesheet"/>
- <link href="css/GrapeCity.ActiveReports.Viewer.Html.css" rel="stylesheet"/>
- </head>
- <body>
- <div class="panel panel-default">
- <div class="panel-heading">
- <div id="appToolbar" class="btn-toolbar" style="margin-bottom: 10px">
- <button type="button" class="btn" id="btnPrint">
- Print</button>
- <button type="button" class="btn" id="btnExport">
- Export to PDF</button>
- <button type="button" class="btn" id="btnWord">
- Export to Word</button>
- <button type="button" class="btn" id="btnExcel">
- Export to Excel</button>
- </div>
- </div>
- <ul id="paginator" class="pagination"></ul>
- <div id="viewer"style="width:1000px; height:600px;">
- </div>
- </div>
- <script src="Scripts/jquery-1.10.2.js"></script>
- <script src="Scripts/bootstrap-3.0.0.js"></script>
- <script src="Scripts/knockout-2.3.0.js"></script>
- <script src="Scripts/GrapeCity.ActiveReports.Viewer.Html.js"></script>
- <script type="text/javascript">
- $(function () {
- var paginator = $('#paginator');
- var viewer = GrapeCity.ActiveReports.Viewer(
- {
- element: '#viewer',
- report: {
- id: "JSON数据.rdlx"
- },
- reportService: {
- url: '/ActiveReports.ReportService.asmx'
- },
- //Setting the uiType to Custom
- uiType: 'desktop',
- documentLoaded: function () {
- setPaginator();
- },
- localeUri: 'Scripts/i18n/zh.txt'
- });
- //Creating the function for Printing
- $('#btnPrint').click(function () {
- viewer.print();
- });
- //Creating the function for Exporting PDF
- $('#btnExport').click(function () {
- viewer.export('Pdf', function (uri) {
- window.open(uri);
- }, false, {});
- });
- //Creating the function for Exporting Word
- $('#btnWord').click(function () {
- viewer.export('word', function (uri) {
- window.open(uri);
- }, false, { fileName: "AR.Open XML" });
- });
- //Creating the function for Exporting excel
- $('#btnExcel').click(function () {
- viewer.export('Xls', function (uri) {
- window.open(uri);
- }, false, {});
- });
- //Creating the function for using Paginator control to display report pages and to navigate through them
- function setPaginator() {
- if (viewer.pageCount > 0) {
- for (var i = 1; i <= viewer.pageCount; i++) {
- $('<li data-bind="' + i + '"><a class="js-page" href="javascript:void(0)">' + i + '</a></li>').appendTo(paginator);
- }
- paginator.children(":first").addClass('active');
- paginator.children().click(function () {
- var self = $(this);
- viewer.goToPage(self.attr('data-bind'), 0, function () {
- paginator.children().removeClass('active');
- self.addClass('active');
- });
- });
- }
- }
- });
- </script>
- </body>
- </html>
复制代码 具体可参考附件的demo |