The following steps set a style sheet source and apply style to a TextBox control.
Visual Basic.NET code. Paste INSIDE the Form Load event. |
Copy Code
|
---|---|
'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) |
C# code. Paste INSIDE the Form Load event. |
Copy Code
|
---|---|
//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); |