Back to Devexpress

XtraReport.StyleSheetPath Property

xtrareports-devexpress-dot-xtrareports-dot-ui-dot-xtrareport-cb5da81f.md

latest4.6 KB
Original Source

XtraReport.StyleSheetPath Property

SECURITY-RELATED CONSIDERATIONS

Using file paths sourced from untrusted input may expose unauthorized files or allow unintended file access. Always validate and normalize all external paths to prevent path manipulation.

Gets or sets a path to the style sheet contained in a style sheet file.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
[DefaultValue("")]
[SRCategory(ReportStringId.CatAppearance)]
public string StyleSheetPath { get; set; }
vb
<SRCategory(ReportStringId.CatAppearance)>
<DefaultValue("")>
Public Property StyleSheetPath As String

Property Value

TypeDefaultDescription
StringString.Empty

A path to the style sheet file.

|

Remarks

You can use the StyleSheetPath property to change a report control’s style programmatically:

  • associate the report control with a style name;
  • add different styles with this name to style sheet files;
  • change the report’s StyleSheetPath property value in code depending on a parameter.

Refer to the Store Report Style Sheets topic for instructions on how to implement this task.

You can also use the StyleSheet property to assign a style sheet to a report. If you specify both the StyleSheet and StyleSheetPath properties, the styles loaded from a style sheet file have a higher priority than the styles that are defined in the report’s style sheet. This means that if the styles stored in the report have the same names as the styles loaded from a style sheet file, the styles in the file substitute their namesakes.

Note

The styles loaded from a file cannot be edited in a report.

Create a style sheet file in the StyleSheet Editor that is invoked for the XtraReport.StyleSheet property in the Report Designer.

You can assign both absolute and relative paths to the StyleSheetPath property.

An absolute path specifies a complete path to the style sheet file. If you move your application to another directory, you have to update the specified path.

A relative path refers to a location that is relative to the base directory. The following table details what folder you should take as the base directory.

Application in Visual Studio (Design Time or Runtime)Deployed Application
The application project’s directoryThe application’s directory

Perform the following steps before you deploy your application to provide relative path resolution.

Desktop

  • Set the style sheet file’s Copy to Output Directory property to Copy Always.
  • Set the style sheet file’s Build Action property to Content.
  • To specify image paths relative to another directory (not the application’s BaseDirectory ), set the global DXResourceDirectory variable.

ASP.NET Web Forms & MVC

  • Set the style sheet file’s Copy to Output Directory property to Copy Always.

  • Set the style sheet file’s Build Action property to Content.

  • Set directory access rules.

  • Set the global DXResourceDirectory variable.

ASP.NET Core

  • Set the style sheet file’s Copy to Output Directory property to Copy Always.

  • Set the style sheet file’s Build Action property to Content.

  • Set directory access rules.

  • Set the global DXResourceDirectory variable.

See Also

StyleSheet

Store Report Style Sheets

XtraReport Class

XtraReport Members

DevExpress.XtraReports.UI Namespace