FlexReports
ActiveReports
SSRS Reports
PDF Files
Sample
Source
1
2
3
4
5
6
7
8
9
10
11
12
13
using System.Web.Mvc;
 
namespace FlexViewerExplorer.Controllers
{
    public partial class FlexViewerController : Controller
    {
        // GET: Intro
        public ActionResult Intro()
        {
            return View();
        }
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
@using FlexViewerExplorer.Models;
 
<script>
    var c1WebApiServiceUrl = '@Url.Content("~/api/report/")';
</script>
<div id="reportViewerContainer">
    @(Html.C1().ReportViewer()
        .Id("reportViewer")
        .CssStyle("width", "100%")
        .FilePath(ReportFiles.SelectedReportPath)
        .ReportName(ReportFiles.SelectedReportName)
        .ZoomMode(ZoomMode.PageWidth).ThresholdWidth(650))
</div>
<div id="pdfViewerContainer" class="hidden">
    @(Html.C1().PdfViewer()
        .Id("pdfViewer")
        .CssStyle("width", "100%")
        .FilePath(Documents.Pdfs.SelectedDocumentPath)
        .ZoomMode(ZoomMode.PageWidth).ThresholdWidth(650))
</div>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using Microsoft.Owin;
using Owin;
using System;
using System.IO;
using System.Web.Http;
using System.Web.Mvc;
using System.Web.Optimization;
using System.Web.Routing;
 
[assembly: OwinStartupAttribute(typeof(FlexViewerExplorer.Startup))]
namespace FlexViewerExplorer
{
    public class Startup
    {
        public void Configuration(IAppBuilder app)
        {
            var pdfsFolder = GetFullRoot("PdfsRoot");
            app.UseStorageProviders().AddDiskStorage("PdfsRoot", pdfsFolder);
            var reportsFolder = GetFullRoot("ReportsRoot");
            app.UseReportProviders().AddFlexReportDiskStorage("ReportsRoot", reportsFolder);
 
            var ssrsUrl = System.Configuration.ConfigurationManager.AppSettings["SsrsUrl"];
            var ssrsUserName = System.Configuration.ConfigurationManager.AppSettings["SsrsUserName"];
            var ssrsPassword = System.Configuration.ConfigurationManager.AppSettings["SsrsPassword"];
            app.UseReportProviders().AddSsrsReportHost("c1ssrs", ssrsUrl, new System.Net.NetworkCredential(ssrsUserName, ssrsPassword));
        }
        private static string GetFullRoot(string root)
        {
            var applicationBase = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
            var fullRoot = Path.GetFullPath(Path.Combine(applicationBase, root));
            if (!fullRoot.EndsWith(Path.DirectorySeparatorChar.ToString(), StringComparison.Ordinal))
            {
                // When we do matches in GetFullPath, we want to only match full directory names.
                fullRoot += Path.DirectorySeparatorChar;
            }
 
            return fullRoot;
        }
    }
}