[]
The following steps set a style sheet source and apply style to a TextBox control.
In Visual Studio, create a new Page Report Application or open an existing one.
On the Form.cs or Form.vb that opens, double-click the title bar to create the Form_Load event.
Add the following code inside the Form_Load event.
'Path and Name of the loaded PageReport
Dim filePath As String = "C:\SampleReport.rdlx"
Dim pageReport As New GrapeCity.ActiveReports.PageReport(New System.IO.FileInfo(filePath))
Dim reportDocument As New GrapeCity.ActiveReports.Document.PageDocument(pageReport)
' Set the style sheet source and value using external style sheets
reportDocument.PageReport.Report.StyleSheetSource = GrapeCity.ActiveReports.PageReportModel.StyleSheetSource.External
reportDocument.PageReport.Report.StyleSheetValue = "C:\ExternalStyle.rdlx-styles"
' Set the style sheet source and value using embedded style sheets
reportDocument.PageReport.Report.StyleSheetSource = GrapeCity.ActiveReports.PageReportModel.StyleSheetSource.Embedded
reportDocument.PageReport.Report.StyleSheetValue = "EmbeddedStylesheet1
' Add a Textbox control and apply style
Dim text As New GrapeCity.ActiveReports.PageReportModel.TextBox()
text.Value = "Sample Text"
text.Style.StyleName = "Style1"
pageReport.Report.Body.ReportItems.Add(text)
viewer1.LoadDocument(reportDocument)
//Path and Name of the loaded PageReport
string filePath = @"C:\SampleReport.rdlx";
GrapeCity.ActiveReports.PageReport pageReport =
new GrapeCity.ActiveReports.PageReport(new System.IO.FileInfo(filePath));
GrapeCity.ActiveReports.Document.PageDocument reportDocument =
new GrapeCity.ActiveReports.Document.PageDocument(pageReport);
// Set the style sheet source and value using external style sheets
reportDocument.PageReport.Report.StyleSheetSource = GrapeCity.ActiveReports.PageReportModel.StyleSheetSource.External;
reportDocument.PageReport.Report.StyleSheetValue = @"C:\ExternalStyle.rdlx-styles";
// Set the style sheet source and value using embedded style sheets
reportDocument.PageReport.Report.StyleSheetSource = GrapeCity.ActiveReports.PageReportModel.StyleSheetSource.Embedded;
reportDocument.PageReport.Report.StyleSheetValue = "EmbeddedStylesheet1";
// Add a Textbox control and apply style
GrapeCity.ActiveReports.PageReportModel.TextBox text =
new GrapeCity.ActiveReports.PageReportModel.TextBox();
text.Value = "Sample Text";
text.Style.StyleName = "Style1";
pageReport.Report.Body.ReportItems.Add(text);
viewer1.LoadDocument(reportDocument);