xtrareports-devexpress-dot-xtrareports-dot-ui-dot-xrcontrol-3d8918e5.md
Specifies report control visibility on printouts and in documents exported to specific formats.
Namespace : DevExpress.XtraReports.UI
Assembly : DevExpress.XtraReports.v25.2.dll
NuGet Package : DevExpress.Reporting.Core
[SRCategory(ReportStringId.CatBehavior)]
public virtual CanPublishOptions CanPublishOptions { get; }
<SRCategory(ReportStringId.CatBehavior)>
Public Overridable ReadOnly Property CanPublishOptions As CanPublishOptions
| Type | Description |
|---|---|
| CanPublishOptions |
A CanPublishOptions object that contains settings to specify whether the control is visible on printouts and in exported documents.
|
Use CanPublishOptions to hide report controls in exported documents and printouts. The XRControl.CanPublishOptions property allows you to access the CanPublishOptions object. Specify settings to hide a report control on printouts or when exported to a document in a certain format.
To hide a report control on printouts and in all exported documents, set CanPublishOptions.AllFormats to false.
The following code snippet excludes page information (the XRPageInfo instance) when exporting a report to XLS, XLSX, and CSV formats:
using DevExpress.XtraReports.UI;
// ...
XtraReport report = new XtraReport();
DetailBand detailBand = new DetailBand();
report.Bands.Add(detailBand);
XRPageInfo xrPageInfo1 = new XRPageInfo{
// Add content.
};
detailBand.Controls.Add(xrPageInfo1);
// Hide xrPageInfo1 from XLS, XLSX, and CSV formats.
xrPageInfo1.CanPublishOptions.Xlsx = false;
xrPageInfo1.CanPublishOptions.Xls = false;
xrPageInfo1.CanPublishOptions.Csv = false;
Imports DevExpress.XtraReports.UI
' ...
Private report As New XtraReport()
Private detailBand As New DetailBand()
report.Bands.Add(detailBand)
Dim xrPageInfo1 As XRPageInfo = New XRPageInfo From { }
detailBand.Controls.Add(xrPageInfo1)
' Hide xrPageInfo1 from XLS, XLSX, and CSV formats.
xrPageInfo1.CanPublishOptions.Xlsx = False
xrPageInfo1.CanPublishOptions.Xls = False
xrPageInfo1.CanPublishOptions.Csv = False
You can also specify CanPublishOptions in the Properties grid:
The following image illustrates the resulting XLXS document with and without page information:
See Also