ActiveReports 9 Server
Viewing Reports using HTML5 Viewer
Show AllShow All
Hide AllHide All

The following steps describe how to view reports in the HTML5 Viewer.

  1. Copy the following files from the ...\ActiveReports 9 Server\SDK\HTML5 Viewer.Source folder to a folder accessible from the target HTML page:
    • GrapeCity.ActiveReports.Viewer.Html.js
    • GrapeCity.ActiveReports.Viewer.Html.min.js
    • GrapeCity.ActiveReports.Viewer.Html.cs 
  2. In the target HTML page, add the references to the GrapeCity.ActiveReports.Viewer.Html.css, GrapeCity.ActiveReports.Viewer.Html.js and its dependencies:
    • jQuery 1.9.0 or higher
    • Bootstrap 3.0
    • Knockout.js 2.3.0 or higher
    Note: You can access the dependencies like jQuery in a Content Delivery Network (CDN) or copy them locally.
    HTML
    Copy Code
    <link rel="stylesheet" href="GrapeCity.ActiveReports.Viewer.Html.css" >
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
    <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
    <script src="http://cdnjs.cloudflare.com/ajax/libs/knockout/2.3.0/knockout-min.js" type="text/javascript"></script>
    <script src="Scripts/GrapeCity.ActiveReports.Viewer.Html.js" type="text/javascript"></script>
    <script type="text/javascript">
    </script>
    
  3. In the target HTML page, add the DIV element that will contain the HTML5 Viewer.
    HTML
    Copy Code
    <div id="viewer" style="width:600px;height:480px;"></div>                                               
    
  4. Add the following code to initialize the HTML5 Viewer. The code might vary depending on the technology that you use to develop the HTML5 Viewer component. To learn how to get a security token for the reportService, see Get a Security Token.
    Javascript
    Copy Code
    $(function ()
    {
       var viewer = GrapeCity.ActiveReports.Viewer(
       {
          element: '#viewer',
          report: {
             id: "myreport"
    
          },
          
          reportService: {
              url: 'http://myAR9server.com/ReportService.svc/json/', 
              securityToken: securityToken, 
              resourceHandler : 'http://myAR9server.com/TemporaryResource.axd/'
          },
          uiType: 'desktop',
          documentLoaded: function reportLoaded()
          {
             console.log(viewer.pageCount);
          },
          reportLoaded: function (reportInfo)
          {
             console.log(reportInfo.parameters);
          },
    
          error: function (error)
          {
             console.log("error");
          }
    
       });
    });
    
  5. Add the following code to the system.webServer section of the web.config file of your ActiveReports 9 Server web site.
    XML
    Copy Code
    <system.webServer>
    
            <httpProtocol>
    
                    <customHeaders>
    
                            <add name="Access-Control-Allow-Origin" value="*" />
    
                            <add name="Access-Control-Allow-Headers" value="Authorization, Origin, Content-Type, Accept, X-Requested-With" />
    
                    </customHeaders>
    
            </httpProtocol>
    
    ...
    
    </system.webServer>
    
See Also

SDK Tutorials

 

 


Copyright © 2016 GrapeCity, inc. All rights reserved

Support Forum