Beispiel #1
0
        public JsonResult ViewReportPage(string reportPath, int?page = 0)
        {
            var model = this.GetReportViewerModel(Request);

            model.ViewMode   = ReportViewModes.View;
            model.ReportPath = reportPath;

            var contentData = ReportServiceHelpers.ExportReportToFormat(model, ReportFormats.Html4_0, page, page);
            var content     = System.Text.Encoding.ASCII.GetString(contentData.ReportData);

            if (model.UseCustomReportImagePath && model.ReportImagePath.HasValue())
            {
                content = ReportServiceHelpers.ReplaceImageUrls(model, content);
            }

            var jsonResult = Json(
                new
            {
                CurrentPage = contentData.CurrentPage,
                Content     = content,
                TotalPages  = contentData.TotalPages
            }
                , JsonRequestBehavior.AllowGet
                );

            jsonResult.MaxJsonLength = int.MaxValue;

            return(jsonResult);
        }
        public async Task <JsonResult> ViewReportPage(string reportPath, int?page = 0)
        {
            var model = this.GetReportViewerModel(Request);

            model.ViewMode   = ReportViewModes.View;
            model.ReportPath = reportPath;

            var contentData = await ReportServiceHelpers.ExportReportToFormatAsync(model, ReportFormats.Html4_0, page, page);

            var content = model.Encoding.GetString(contentData.ReportData);

            if (model.UseCustomReportImagePath && model.ReportImagePath.HasValue())
            {
                content = ReportServiceHelpers.ReplaceImageUrls(model, content);
            }

            var jsonResult = Json(
                new
            {
                CurrentPage = contentData.CurrentPage,
                Content     = content,
                TotalPages  = contentData.TotalPages
            }
                );

            return(jsonResult);
        }
        public JsonResult ViewReportPage(string reportPath, int?page = 0)
        {
            var model = this.GetReportViewerModel(Request);

            model.ViewMode   = ReportViewModes.View;
            model.ReportPath = reportPath;

            model.Encoding = System.Text.Encoding.UTF8;

            var contentData = ReportServiceHelpers.ExportReportToFormat(model, ReportFormats.Html4_0, page, page);
            var content     = model.Encoding.GetString(contentData.ReportData);

            if (model.UseCustomReportImagePath && model.ReportImagePath.HasValue())
            {
                content = ReportServiceHelpers.ReplaceImageUrls(model, content);
            }

            var jsonResult = Json(
                new
            {
                CurrentPage = contentData.CurrentPage,
                Content     = content,
                TotalPages  = contentData.TotalPages
            },
                new Newtonsoft.Json.JsonSerializerSettings()
            {
                ContractResolver = new Newtonsoft.Json.Serialization.DefaultContractResolver()
            }
                );

            return(jsonResult);
        }
        public static List <ReportParameterInfo> getReportParameters(ReportViewerModel model)
        {
            var contentData       = new ReportExportResult();
            var definedParameters = ReportServiceHelpers.GetReportParameters(model, true);

            contentData.SetParameters(definedParameters, model.Parameters);
            return(contentData.Parameters);
        }
Beispiel #5
0
        public JsonResult FindStringInReport(string reportPath, string searchText, int?startPage = 0)
        {
            var model = GetReportViewerModel(Request);

            model.ViewMode   = ReportViewModes.View;
            model.ReportPath = reportPath;

            return(Json(ReportServiceHelpers.FindStringInReport(model, searchText, startPage).ToInt32(), JsonRequestBehavior.AllowGet));
        }
        public JsonResult FindStringInReport(string reportPath, string searchText, int?page = 0)
        {
            var model = this.GetReportViewerModel(Request);

            model.ViewMode   = ReportViewModes.View;
            model.ReportPath = reportPath;

            return(Json(ReportServiceHelpers.FindStringInReport(model, searchText, page).ToInt32()));
        }
        public async Task <ActionResult> PrintReport(string reportPath)
        {
            var model = this.GetReportViewerModel(Request);

            model.ViewMode   = ReportViewModes.Print;
            model.ReportPath = reportPath;

            var contentData = await ReportServiceHelpers.ExportReportToFormatAsync(model, ReportFormats.Html4_0);

            var content = model.Encoding.GetString(contentData.ReportData);

            content = ReportServiceHelpers.ReplaceImageUrls(model, content);

            var sb = new System.Text.StringBuilder();

            sb.AppendLine("<html>");
            sb.AppendLine("	<body>");
            //sb.AppendLine($"		<img src='data:image/tiff;base64,{Convert.ToBase64String(contentData.ReportData)}' />");
            sb.AppendLine($"		{content}");
            sb.AppendLine("		<script type='text/javascript'>");
            sb.AppendLine("			(function() {");

            /*
             * sb.AppendLine("				var beforePrint = function() {");
             * sb.AppendLine("					console.log('Functionality to run before printing.');");
             * sb.AppendLine("				};");
             */
            sb.AppendLine("				var afterPrint = function() {");
            sb.AppendLine("					window.onfocus = function() { window.close(); };");
            sb.AppendLine("					window.onmousemove = function() { window.close(); };");
            sb.AppendLine("				};");

            sb.AppendLine("				if (window.matchMedia) {");
            sb.AppendLine("					var mediaQueryList = window.matchMedia('print');");
            sb.AppendLine("					mediaQueryList.addListener(function(mql) {");
            sb.AppendLine("						if (mql.matches) {");
            //sb.AppendLine("							beforePrint();");
            sb.AppendLine("						} else {");
            sb.AppendLine("							afterPrint();");
            sb.AppendLine("						}");
            sb.AppendLine("					});");
            sb.AppendLine("				}");

            //sb.AppendLine("				window.onbeforeprint = beforePrint;");
            sb.AppendLine("				window.onafterprint = afterPrint;");

            sb.AppendLine("			}());");
            sb.AppendLine("			window.print();");
            sb.AppendLine("		</script>");
            sb.AppendLine("	</body>");

            sb.AppendLine("<html>");

            return(Content(sb.ToString(), "text/html"));
        }
        public async Task <JsonResult> FindStringInReport(string reportPath, string searchText, int?page = 0)
        {
            var model = this.GetReportViewerModel(Request);

            model.ViewMode   = ReportViewModes.View;
            model.ReportPath = reportPath;

            var result = await ReportServiceHelpers.FindStringInReportAsync(model, searchText, page);

            return(Json(result.ToInt32()));
        }
        public static string ParametersToHtmlString(System.Collections.Generic.List <ReportParameterInfo> parameters, ReportViewerModel model)
        {
            StringBuilder sb = new StringBuilder();

            if (parameters == null)
            {
                var contentData       = new ReportExportResult();
                var definedParameters = ReportServiceHelpers.GetReportParameters(model, true);
                contentData.SetParameters(definedParameters, model.Parameters);
                parameters = contentData.Parameters;
            }

            //Parameters start
            foreach (var reportParameter in parameters)
            {
                sb.AppendLine("					<div class='Parameter col-md-6 col-sm-12'>");
                if (reportParameter.PromptUser || model.ShowHiddenParameters)
                {
                    sb.AppendLine($"						<div class='col-sm-4'><label for='{reportParameter.Name}'>{reportParameter.Prompt}</label></div>");

                    sb.AppendLine("							<div class='col-sm-8'>");
                    if (reportParameter.ValidValues != null && reportParameter.ValidValues.Any())
                    {
                        sb.AppendLine($"						<select id='{reportParameter.Name}' name='{reportParameter.Name}' class='form-control' {(reportParameter.MultiValue == true ? "multiple='multiple'" : "")}>");
                        foreach (var value in reportParameter.ValidValues)
                        {
                            sb.AppendLine($"							<option value='{value.Value}' {(reportParameter.SelectedValues.Contains(value.Value) ? "selected='selected'" : "")}>{value.Label}</option>");
                        }
                        sb.AppendLine($"						</select>");
                    }
                    else
                    {
                        var selectedValue = reportParameter.SelectedValues.FirstOrDefault();

                        if (reportParameter.Type == ReportService.ParameterTypeEnum.Boolean)
                        {
                            sb.AppendLine($"						<input type='checkbox' id='{reportParameter.Name}' name='{reportParameter.Name}' class='form-control' {(selectedValue.ToBoolean() ? "checked='checked'" : "")} />");
                        }
                        else if (reportParameter.Type == ReportService.ParameterTypeEnum.DateTime)
                        {
                            sb.AppendLine($"						<input type='datetime' id='{reportParameter.Name}' name='{reportParameter.Name}' class='form-control' value='{selectedValue}' />");
                        }
                        else
                        {
                            sb.AppendLine($"						<input type='text' id='{reportParameter.Name}' name='{reportParameter.Name}' class='form-control' value='{selectedValue}' />");
                        }
                    }

                    sb.AppendLine("							</div>");
                }
                else
                {
                    if (reportParameter.SelectedValues != null && reportParameter.SelectedValues.Any())
                    {
                        var values = reportParameter.SelectedValues.Where(x => x != null).Select(x => x).ToArray();
                        sb.AppendLine($"			<input type='hidden' id='{reportParameter.Name}' name='{reportParameter.Name}' value='{String.Join(",", values)}' />");
                    }
                }

                sb.AppendLine($"			<input type='hidden' id='ReportViewerEnablePaging' name='ReportViewerEnablePaging' value='{model.EnablePaging}' />");

                sb.AppendLine("					</div>");
            }

            return(sb.ToString());
        }
        public static HtmlString RenderReportViewer(this IHtmlHelper helper, ReportViewerModel model, int?startPage = 1)
        {
            var sb = new StringBuilder();

            var reportServerDomainUri = new Uri(model.ServerUrl);
            var contentData           = ReportServiceHelpers.ExportReportToFormat(model, ReportFormats.Html4_0, startPage, startPage);

            sb.AppendLine("<form class='form-inline' id='frmReportViewer' name='frmReportViewer'>");
            sb.AppendLine("	<div class='ReportViewer row'>");
            sb.AppendLine("		<div class='ReportViewerHeader row'>");
            sb.AppendLine("			<div class='ParametersContainer col-sm-12'>");
            sb.AppendLine("				<div class='Parameters col-sm-10'>");

            sb.AppendLine(ParametersToHtmlString(contentData.Parameters, model));

            sb.AppendLine("				</div>");

            sb.AppendLine("				<div class='ReportViewerViewReport col-sm-2 text-center'>");
            sb.AppendLine("					<button type='button' class='btn btn-primary ViewReport'>View Report</button>");
            sb.AppendLine("				</div>");
            sb.AppendLine("			</div>");

            sb.AppendLine("			<div class='ReportViewerToolbar row'>");
            sb.AppendLine("				<div class='ReportViewerPager'>");
            sb.AppendLine("					<div class='btn-toolbar'>");

            if (model.EnablePaging)
            {
                sb.AppendLine("						<div class='btn-group'>");
                sb.AppendLine($"							<a href='#' title='First Page' class='btn btn-default FirstPage'{(contentData.TotalPages == 1 ? " disabled='disabled'" : "")}><span class='glyphicon glyphicon-step-backward'></span></a>");
                sb.AppendLine($"							<a href='#' title='Previous Page' class='btn btn-default PreviousPage'{(contentData.TotalPages == 1 ? " disabled='disabled'" : "")}><span class='glyphicon glyphicon-chevron-left'></span></a>");
                sb.AppendLine("						</div>");
                sb.AppendLine("						<div class='btn-group'>");
                sb.AppendLine($"							<span class='PagerNumbers'><input type='text' id='ReportViewerCurrentPage' name='ReportViewerCurrentPage' class='form-control' value='{contentData.CurrentPage}' /> of <span id='ReportViewerTotalPages'>{contentData.TotalPages}</span></span>");
                sb.AppendLine("						</div>");
                sb.AppendLine("						<div class='btn-group'>");
                sb.AppendLine($"							<a href='#' title='Next Page' class='btn btn-default NextPage'{(contentData.TotalPages == 1 ? " disabled='disabled'" : "")}><span class='glyphicon glyphicon-chevron-right'></span></a>");
                sb.AppendLine($"							<a href='#' title='Last Page' class='btn btn-default LastPage'{(contentData.TotalPages == 1 ? " disabled='disabled'" : "")}><span class='glyphicon glyphicon-step-forward'></span></a>");
                sb.AppendLine("						</div>");
            }
            sb.AppendLine("						<div class='btn-group'>");
            sb.AppendLine("							<span class='SearchText'>");
            sb.AppendLine($"								<input type='text' id='ReportViewerSearchText' name='ReportViewerSearchText' class='form-control' value='' />");
            sb.AppendLine($"								<a href='#' title='Find' class='btn btn-info FindTextButton'><span class='glyphicon glyphicon-search' style='padding-right: .5em;'></span>Find</a>");
            sb.AppendLine("							</span>");
            sb.AppendLine("						</div>");
            sb.AppendLine("						<div class='btn-group'>");
            sb.AppendLine("							<a href='#' title='Export' class='dropdown-toggle btn btn-default' data-toggle='dropdown' role='button' aria-haspopup='true' area-expanded='false'>");
            sb.AppendLine("								<span class='glyphicon glyphicon-floppy-save' style='color: steelblue;'></span>");
            sb.AppendLine("								<span class='caret'></span>");
            sb.AppendLine("							</a>");
            sb.AppendLine("							<ul class='dropdown-menu'>");
            sb.AppendLine("								<li><a href='#' class='ExportCsv'>CSV (comma delimited)</a></li>");
            sb.AppendLine("								<li><a href='#' class='ExportExcelOpenXml'>Excel</a></li>");
            sb.AppendLine("								<li><a href='#' class='ExportMhtml'>MHTML (web archive)</a></li>");
            sb.AppendLine("								<li><a href='#' class='ExportPdf'>PDF</a></li>");
            sb.AppendLine("								<li><a href='#' class='ExportTiff'>TIFF file</a></li>");
            sb.AppendLine("								<li><a href='#' class='ExportWordOpenXml'>Word</a></li>");
            sb.AppendLine("								<li><a href='#' class='ExportXml'>XML file with report data</a></li>");
            sb.AppendLine("							</ul>");
            //sb.AppendLine("						</div>");
            //sb.AppendLine("						<div class='btn-group'>");
            sb.AppendLine("							<a href='#' title='Refresh' class='btn btn-default Refresh'><span class='glyphicon glyphicon-refresh' style='color: green;'></span></a>");
            //sb.AppendLine("						</div>");
            //sb.AppendLine("						<div class='btn-group'>");
            sb.AppendLine("							<a href='#' title='Print' class='btn btn-default Print'><span class='glyphicon glyphicon-print' style='color: grey;'></span></a>");
            sb.AppendLine("						</div>");
            sb.AppendLine("					</div>");
            sb.AppendLine("				</div>");
            sb.AppendLine("			</div>");
            sb.AppendLine("		</div>");
            sb.AppendLine("		<div class='ReportViewerContentContainer row'>");
            sb.AppendLine("			<div class='ReportViewerContent'>");

            if (model.IsMissingAnyRequiredParameterValues(contentData.Parameters))
            {
                sb.AppendLine("			<div class='ReportViewerInformation'>Please fill parameters and run the report...</div>");
            }
            else
            {
                if (model.AjaxLoadInitialReport)
                {
                    sb.AppendLine("			<script type='text/javascript'>$(document).ready(function () { viewReportPage(1); });</script>");
                }
                else
                {
                    if (contentData == null || contentData.ReportData == null || contentData.ReportData.Length == 0)
                    {
                        sb.AppendLine("");
                    }
                    else
                    {
                        var content = model.Encoding.GetString(contentData.ReportData);

                        if (model.UseCustomReportImagePath && model.ReportImagePath.HasValue())
                        {
                            content = ReportServiceHelpers.ReplaceImageUrls(model, content);
                        }

                        sb.AppendLine($"			{content}");
                    }
                }
            }

            sb.AppendLine("			</div>");
            sb.AppendLine("		</div>");
            sb.AppendLine("	</div>");
            sb.AppendLine("</form>");

            sb.AppendLine("<script type='text/javascript'>");
            sb.AppendLine("	function ReportViewer_Register_OnChanges() {");

            var dependencyFieldKeys = new List <string>();

            foreach (var parameter in contentData.Parameters.Where(x => x.Dependencies != null && x.Dependencies.Any()))
            {
                foreach (var key in parameter.Dependencies)
                {
                    if (!dependencyFieldKeys.Contains(key))
                    {
                        dependencyFieldKeys.Add(key);
                    }
                }
            }

            foreach (var queryParameter in contentData.Parameters.Where(x => dependencyFieldKeys.Contains(x.Name)))
            {
                sb.AppendLine("		$('#"+ queryParameter.Name + "').change(function () {");
                sb.AppendLine("			reloadParameters();");
                sb.AppendLine("		});");
            }

            sb.AppendLine("	}");

            sb.AppendLine("</script>");

            return(new HtmlString(sb.ToString()));
        }
        public async Task <FileResult> ExportReport(string reportPath, string format)
        {
            var model = this.GetReportViewerModel(Request);

            model.ViewMode   = ReportViewModes.Export;
            model.ReportPath = reportPath;

            var extension = "";

            switch (format.ToUpper())
            {
            case "CSV":
                format    = "CSV";
                extension = ".csv";
                break;

            case "MHTML":
                format    = "MHTML";
                extension = ".mht";
                break;

            case "PDF":
                format    = "PDF";
                extension = ".pdf";
                break;

            case "TIFF":
                format    = "IMAGE";
                extension = ".tif";
                break;

            case "XML":
                format    = "XML";
                extension = ".xml";
                break;

            case "WORDOPENXML":
                format    = "WORDOPENXML";
                extension = ".docx";
                break;

            case "EXCELOPENXML":
            default:
                format    = "EXCELOPENXML";
                extension = ".xlsx";
                break;
            }

            var contentData = await ReportServiceHelpers.ExportReportToFormatAsync(model, format);

            var filename = reportPath;

            if (filename.Contains("/"))
            {
                filename = filename.Substring(filename.LastIndexOf("/"));
                filename = filename.Replace("/", "");
            }

            filename = filename + extension;

            return(File(contentData.ReportData, contentData.MimeType, filename));
        }
        public static MvcHtmlString RenderReportViewer(this HtmlHelper helper, ReportViewerModel model, int?startPage = 1)
        {
            var sb = new StringBuilder();

            var reportServerDomainUri = new Uri(model.ServerUrl);
            var contentData           = ReportServiceHelpers.ExportReportToFormat(model, ReportFormats.Html4_0, startPage, startPage);

            sb.AppendLine("<form class='form-inline' id='frmReportViewer' name='frmReportViewer'>");
            sb.AppendLine("	<div class='ReportViewer row'>");
            sb.AppendLine("		<div class='ReportViewerHeader col-sm-12'>");
            sb.AppendLine("			<div class='ParametersContainer col-sm-12'>");
            sb.AppendLine("				<div class='Parameters col-sm-10'>");
            //Parameters start
            foreach (var reportParameter in contentData.Parameters)
            {
                sb.AppendLine("					<div class='Parameter col-md-6 col-sm-12'>");
                if (reportParameter.PromptUser || model.ShowHiddenParameters)
                {
                    sb.AppendLine($"						<div class='col-sm-4'><label for='{reportParameter.Name}'>{reportParameter.Prompt}</label></div>");

                    sb.AppendLine("							<div class='col-sm-8'>");
                    if (reportParameter.ValidValues != null && reportParameter.ValidValues.Any())
                    {
                        sb.AppendLine($"						<select id='{reportParameter.Name}' name='{reportParameter.Name}' class='form-control' {(reportParameter.MultiValue == true ? "multiple='multiple'" : "")}>");
                        foreach (var value in reportParameter.ValidValues)
                        {
                            sb.AppendLine($"							<option value='{value.Value}' {(reportParameter.SelectedValues.Contains(value.Value) ? "selected='selected'" : "")}>{value.Key}</option>");
                        }
                        sb.AppendLine($"						</select>");
                    }
                    else
                    {
                        var selectedValue = reportParameter.SelectedValues.FirstOrDefault();

                        if (reportParameter.Type == ReportService.ParameterTypeEnum.Boolean)
                        {
                            sb.AppendLine($"						<input type='checkbox' id='{reportParameter.Name}' name='{reportParameter.Name}' class='form-control' {(selectedValue.ToBoolean() ? "checked='checked'" : "")} />");
                        }
                        else if (reportParameter.Type == ReportService.ParameterTypeEnum.DateTime)
                        {
                            sb.AppendLine($"						<input type='datetime' id='{reportParameter.Name}' name='{reportParameter.Name}' class='form-control' value='{selectedValue}' />");
                        }
                        else
                        {
                            sb.AppendLine($"						<input type='text' id='{reportParameter.Name}' name='{reportParameter.Name}' class='form-control' value='{selectedValue}' />");
                        }
                    }

                    sb.AppendLine("							</div>");
                }
                else
                {
                    if (reportParameter.ValidValues != null && reportParameter.ValidValues.Any())
                    {
                        var values = reportParameter.ValidValues.Where(x => x.Value != null).Select(x => x.Value).ToArray();
                        sb.AppendLine($"			<input type='hidden' id='{reportParameter.Name}' name='{reportParameter.Name}' value='{String.Join(",", values)}' />");
                    }
                    else
                    {
                        var selectedValue = reportParameter.SelectedValues.FirstOrDefault();

                        sb.AppendLine($"			<input type='hidden' id='{reportParameter.Name}' name='{reportParameter.Name}' value='{selectedValue}' />");
                    }
                }

                sb.AppendLine("					</div>");
            }

            sb.AppendLine("				</div>");

            sb.AppendLine("				<div class='ReportViewerViewReport col-sm-2 text-center'>");
            sb.AppendLine("					<button type='button' class='btn btn-primary ViewReport'>View Report</button>");
            sb.AppendLine("				</div>");
            sb.AppendLine("			</div>");

            sb.AppendLine("			<div class='ReportViewerToolbar col-sm-12'>");
            sb.AppendLine("				<div class='ReportViewerPager'>");
            sb.AppendLine("					<div class='btn-toolbar'>");
            sb.AppendLine("						<div class='btn-group'>");
            sb.AppendLine($"							<a href='#' title='First Page' class='btn btn-default FirstPage'{(contentData.TotalPages == 1 ? " disabled='disabled'" : "")}><span class='glyphicon glyphicon-step-backward'></span></a>");
            sb.AppendLine($"							<a href='#' title='Previous Page' class='btn btn-default PreviousPage'{(contentData.TotalPages == 1 ? " disabled='disabled'" : "")}><span class='glyphicon glyphicon-chevron-left'></span></a>");
            sb.AppendLine("						</div>");
            sb.AppendLine("						<div class='btn-group'>");
            sb.AppendLine($"							<span class='PagerNumbers'><input type='text' id='ReportViewerCurrentPage' name='ReportViewerCurrentPage' class='form-control' value='{contentData.CurrentPage}' /> of <span id='ReportViewerTotalPages'>{contentData.TotalPages}</span></span>");
            sb.AppendLine("						</div>");
            sb.AppendLine("						<div class='btn-group'>");
            sb.AppendLine($"							<a href='#' title='Next Page' class='btn btn-default NextPage'{(contentData.TotalPages == 1 ? " disabled='disabled'" : "")}><span class='glyphicon glyphicon-chevron-right'></span></a>");
            sb.AppendLine($"							<a href='#' title='Last Page' class='btn btn-default LastPage'{(contentData.TotalPages == 1 ? " disabled='disabled'" : "")}><span class='glyphicon glyphicon-step-forward'></span></a>");
            sb.AppendLine("						</div>");
            sb.AppendLine("						<div class='btn-group'>");
            sb.AppendLine("							<span class='SearchText'>");
            sb.AppendLine($"								<input type='text' id='ReportViewerSearchText' name='ReportViewerSearchText' class='form-control' value='' />");
            sb.AppendLine($"								<a href='#' title='Find' class='btn btn-info FindTextButton'><span class='glyphicon glyphicon-search' style='padding-right: .5em;'></span>Find</a>");
            sb.AppendLine("							</span>");
            sb.AppendLine("						</div>");
            sb.AppendLine("						<div class='btn-group'>");
            sb.AppendLine("							<a href='#' title='Export' class='dropdown-toggle btn btn-default' data-toggle='dropdown' role='button' aria-haspopup='true' area-expanded='false'>");
            sb.AppendLine("								<span class='glyphicon glyphicon-floppy-save' style='color: steelblue;'></span>");
            sb.AppendLine("								<span class='caret'></span>");
            sb.AppendLine("							</a>");
            sb.AppendLine("							<ul class='dropdown-menu'>");
            sb.AppendLine("								<li><a href='#' class='ExportCsv'>CSV (comma delimited)</a></li>");
            sb.AppendLine("								<li><a href='#' class='ExportExcelOpenXml'>Excel</a></li>");
            sb.AppendLine("								<li><a href='#' class='ExportMhtml'>MHTML (web archive)</a></li>");
            sb.AppendLine("								<li><a href='#' class='ExportPdf'>PDF</a></li>");
            sb.AppendLine("								<li><a href='#' class='ExportTiff'>TIFF file</a></li>");
            sb.AppendLine("								<li><a href='#' class='ExportWordOpenXml'>Word</a></li>");
            sb.AppendLine("								<li><a href='#' class='ExportXml'>XML file with report data</a></li>");
            sb.AppendLine("							</ul>");
            //sb.AppendLine("						</div>");
            //sb.AppendLine("						<div class='btn-group'>");
            sb.AppendLine("							<a href='#' title='Refresh' class='btn btn-default Refresh'><span class='glyphicon glyphicon-refresh' style='color: green;'></span></a>");
            //sb.AppendLine("						</div>");
            //sb.AppendLine("						<div class='btn-group'>");
            sb.AppendLine("							<a href='#' title='Print' class='btn btn-default Print'><span class='glyphicon glyphicon-print' style='color: grey;'></span></a>");
            sb.AppendLine("						</div>");
            sb.AppendLine("					</div>");
            sb.AppendLine("				</div>");
            sb.AppendLine("			</div>");
            sb.AppendLine("		</div>");
            sb.AppendLine("		<div class='ReportViewerContentContainer'>");
            sb.AppendLine("			<div class='ReportViewerContent'>");

            if (contentData == null || contentData.ReportData == null || contentData.ReportData.Length == 0)
            {
                sb.AppendLine("");
            }
            else
            {
                var content = Encoding.ASCII.GetString(contentData.ReportData);

                if (model.UseCustomReportImagePath && model.ReportImagePath.HasValue())
                {
                    content = ReportServiceHelpers.ReplaceImageUrls(model, content);
                }

                sb.AppendLine($"			{content}");
            }

            sb.AppendLine("			</div>");
            sb.AppendLine("		</div>");
            sb.AppendLine("	</div>");
            sb.AppendLine("</form>");

            return(new MvcHtmlString(sb.ToString()));
        }