Back to Devexpress

XtraReport.PrinterName Property

xtrareports-devexpress-dot-xtrareports-dot-ui-dot-xtrareport-8790480e.md

latest2.5 KB
Original Source

XtraReport.PrinterName Property

Specifies the name of the printer to use for printing the report.

Namespace : DevExpress.XtraReports.UI

Assembly : DevExpress.XtraReports.v25.2.dll

NuGet Package : DevExpress.Reporting.Core

Declaration

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

Property Value

TypeDefaultDescription
StringString.Empty

A String value, specifying the name of the printer to use.

|

Remarks

Use the PrinterName property to specify the printer you want to use for printing the report. The specified printer should be installed on the machine.

The PrinterName property should be specified before creating a document (which is performed using the XtraReport.CreateDocument method) as shown in the following code sample.

csharp
private string printerName = "<my printer name>";
private void PrintReport() {
    XtraReport report = new XtraReport1();

    //Specify the printer name.
    report.PrinterName = printerName;

    //Create the document.
    report.CreateDocument();

    ReportPrintTool pt = new ReportPrintTool(report);
    pt.PrintDialog();
}
vb
Private printerName As String = "<my printer name>"
Private Sub PrintReport()
    Dim report As XtraReport = New XtraReport1()

    'Specify the printer name.
    report.PrinterName = printerName

    'Create the document.
    report.CreateDocument()

    Dim pt As New ReportPrintTool(report)
    pt.PrintDialog()
End Sub

See Also

XtraReport Class

XtraReport Members

DevExpress.XtraReports.UI Namespace