Back to Devexpress

CanPublishOptions Class

xtrareports-devexpress-dot-xtrareports-dot-ui-85a476d2.md

latest4.9 KB
Original Source

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.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

csharp
public class CanPublishOptions
vb
Public Class CanPublishOptions

The following members return CanPublishOptions objects:

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.CsvSpecifies report control visibility when exporting to CSV.CanPublishOptions.DocxSpecifies report control visibility when exporting to DOCX.CanPublishOptions.HtmSpecifies report control visibility when exporting to HTM.CanPublishOptions.ImageSpecifies report control visibility when exporting as an image.CanPublishOptions.MhtSpecifies report control visibility when exporting to MHT.CanPublishOptions.PdfSpecifies report control visibility when exporting to PDF.CanPublishOptions.PrintingSpecifies report control visibility on printouts.CanPublishOptions.RtfSpecifies report control visibility when exporting to RTF.CanPublishOptions.TxtSpecifies report control visibility when exporting to TXT.CanPublishOptions.XlsSpecifies report control visibility when exporting to XLS.CanPublishOptions.XlsxSpecifies report control visibility when exporting to XLSX.CanPublishOptions.AllFormatsSpecifies 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:

csharp
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;
vb
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:

Inheritance

Object CanPublishOptions

See Also

CanPublishOptions Members

DevExpress.XtraReports.UI Namespace