or
public
MyReport(Uri stylesheet):
this
()
{
this
.ExternalStyleSheets.Clear();
this
.ExternalStyleSheets.Add(
new
ExternalStyleSheet(stylesheet));
}
public
ActionResult MyReport()
{
var xml =
new
Uri(
"http://mydomain.com"
+ Url.Action(
"ReportStyleSheet"
,
"Theme"
));
var report =
new
MyReport(xml);
return
ReportViewer(report);
}
private
ViewResult ReportViewer(Report report)
{
return
View(
"ReportViewer"
, report);
}
public
ActionResult ReportStyleSheet()
{
var xml =
string
.Empty;
if
(
this
.Request.IsAuthenticated)
{
//replaceDictionary replaces the color schemes
xml = template.BuildTemplate(
"ReportStyleSheet.xml"
, replaceDictionary);
}
return
Content(xml,
"application/xml"
);
}
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<
Telerik.Reporting.Report
>" %>
<%@ Register assembly="Telerik.Reporting, Version=7.0.13.521, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" namespace="Telerik.Reporting" tagprefix="telerik" %>
<%@ Register assembly="Telerik.ReportViewer.WebForms, Version=7.0.13.521, Culture=neutral, PublicKeyToken=a9d7983dfcc261be" namespace="Telerik.ReportViewer.WebForms" tagprefix="telerik" %>
<
telerik:ReportViewer
ID
=
"ReportViewer1"
style
=
"height: 700px; width: 100%; margin-bottom: 30px;"
runat
=
"server"
></
telerik:ReportViewer
>
<script runat=
"server"
>
public override void VerifyRenderingInServerForm(Control control)
{
// to avoid the server form (<form runat="server"> requirement
}
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
try
{
var
instanceReportSource =
new
InstanceReportSource();
instanceReportSource.ReportDocument = Model;
ReportViewer1.ReportSource = instanceReportSource;
}
catch
(Exception ex)
{
Response.Write(ex.Message);
}
}
</script>
this
.PageSettings.Landscape =
true
;
this
.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.Letter;
m_ReelLabel.UnitOfMeasure = UnitType.Mm;
m_ReelLabel.Width = new Unit(98.0, UnitType.Mm);
DetailSection detail = new DetailSection();
detail.Height = new Unit(50.0, UnitType.Mm);
m_ReelLabel.PageSettings.PaperKind = PaperKind.Custom;
m_ReelLabel.PageSettings.PaperSize = new SizeU(new Unit(104, UnitType.Mm), new Unit(60, UnitType.Mm));
m_ReelLabel.PageSettings.Margins.Left = new Unit(2.0, UnitType.Mm);
m_ReelLabel.PageSettings.Margins.Right = new Unit(2.0, UnitType.Mm);
m_ReelLabel.PageSettings.Margins.Top = new Unit(2.0, UnitType.Mm);
m_ReelLabel.PageSettings.Margins.Bottom = new Unit(2.0, UnitType.Mm);
InstanceReportSource src = new InstanceReportSource();
src.ReportDocument = m_ReelLabel;
PrinterSettings printerSettings = new PrinterSettings();
PrintController standardPrintController = new StandardPrintController();
Telerik.Reporting.Processing.ReportProcessor processor = new Telerik.Reporting.Processing.ReportProcessor();
processor.PrintController = standardPrintController;
processor.PrintReport(src, printerSettings);