CanPublishOptions Class
Contains settings that specify report control visibility on printouts and documents exported to specific formats.
Namespace: DevExpress.XtraReports.UI
Assembly: DevExpress.XtraReports.v25.1.dll
NuGet Package: DevExpress.Reporting.Core
Declaration
Remarks
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.
The following formats are available:
- CanPublishOptions.Csv
- Specifies report control visibility when exporting to CSV.
- CanPublishOptions.Docx
- Specifies report control visibility when exporting to DOCX.
- CanPublishOptions.Htm
- Specifies report control visibility when exporting to HTM.
- CanPublishOptions.Image
- Specifies report control visibility when exporting as an image.
- CanPublishOptions.Mht
- Specifies report control visibility when exporting to MHT.
- CanPublishOptions.Pdf
- Specifies report control visibility when exporting to PDF.
- CanPublishOptions.Printing
- Specifies report control visibility on printouts.
- CanPublishOptions.Rtf
- Specifies report control visibility when exporting to RTF.
- CanPublishOptions.Txt
- Specifies report control visibility when exporting to TXT.
- CanPublishOptions.Xls
- Specifies report control visibility when exporting to XLS.
- CanPublishOptions.Xlsx
- Specifies report control visibility when exporting to XLSX.
- CanPublishOptions.AllFormats
- Specifies whether the control is visible on printouts and in all exported documents.
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;
You can also specify CanPublishOptions
in the Properties grid:
The following image illustrates the resulting XLXS document with and without page information: