Back to Devexpress

ExportSettings.UseSameTab Property

corelibraries-devexpress-dot-xtrareports-dot-web-dot-webdocumentviewer-dot-datacontracts-dot-exportsettings.md

latest6.9 KB
Original Source

ExportSettings.UseSameTab Property

Specifies whether to print and export documents in the browser tab that contains the Document Viewer.

Namespace : DevExpress.XtraReports.Web.WebDocumentViewer.DataContracts

Assembly : DevExpress.Data.v25.2.dll

NuGet Package : DevExpress.Data

Declaration

csharp
[DataMember(Name = "useSameTab")]
public bool UseSameTab { get; set; }
vb
<DataMember(Name:="useSameTab")>
Public Property UseSameTab As Boolean

Property Value

TypeDescription
Boolean

true , to print and export documents in the tab that contains the Document Viewer; false to open another browser tab for print and export.

|

Property Paths

You can access this nested property as listed below:

LibraryObject TypePath to UseSameTab
Cross-Platform Class LibraryReportPreviewSettings

.ExportSettings .UseSameTab

| | WebDocumentViewerSettingsBase |

.ExportSettings .UseSameTab

| | .NET Reporting Tools | DxReportDesignerReportPreviewSettings |

.ExportSettings .UseSameTab

|

Remarks

Use the UseSameTab property to specify whether to print and export documents in the same browser tab where the Document Viewer is placed, or in a separate tab.

UseSameTab = True (Default)

When a user clicks the Print toolbar icon, the Print dialog appears in the tab that contains the Document Viewer.

When a document is printed, the Document Viewer displays an additional dialog with a link to the PDF file that was sent to the printer.

This dialog helps users troubleshoot issues when the browser is unable to print a document. Disable the ShowPrintNotificationDialog property to hide this dialog. However, we recommend that your application should allow users to enable the ShowPrintNotificationDialog property or keep it enabled for cases when a browser stops printing documents after an update.

You can localize the dialog with the following localization strings:

UseSameTab = False

When a user clicks the Print toolbar icon, the Document Viewer opens a new browser tab to display the Print dialog.

Code Examples

ASP.NET Core

cshtml
@{
    var viewerRender = Html.DevExpress().WebDocumentViewer("DocumentViewer")
        .Height("1000px")
        .ExportSettings(settings =>
        {
            settings.UseSameTab = false;
        })
        .Bind("TestReport");
    @viewerRender.RenderHtml()
}
cshtml
@{ var designerRender = Html.DevExpress().ReportDesigner("reportDesigner")
                     .Height("1000px")
                     .ReportPreviewSettings(previewsettings =>
                     {
                         previewsettings.ExportSettings.UseSameTab = false;
                     })
                     .Bind("TestReport");
    @designerRender.RenderHtml() 
}

Angular

report-viewer.html

html
<dx-report-viewer [reportUrl]="reportUrl" height="800px">
    <dxrv-request-options [invokeAction]="invokeAction" [host]="hostUrl"></dxrv-request-options>
    <dxrv-export-settings [useSameTab]="useSameTabExport"></dxrv-export-settings>
</dx-report-viewer>>

report-viewer.ts

typescript
import { Component, Inject, OnInit, ViewEncapsulation } from '@angular/core';

@Component({
  selector: 'report-viewer',
    encapsulation: ViewEncapsulation.None,
    templateUrl: './report-viewer.html',
  styleUrls: [
    //...
  ]
})
export class ReportViewerComponent {
    reportUrl: string = "TestReport";
    invokeAction: string = '/DXXRDV';
    useSameTabExport: boolean = false;
: boolean = true;
    // ...
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the UseSameTab property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

reporting-asp-net-core-set-print-job-name-in-printer-queue/CS/dxExampleWebDocViewerChangeJobPrintName/Controllers/HomeController.cs#L29

csharp
var viewerModel = viewerModelGenerator.GetModel(reportName, CustomWebDocumentViewerController.DefaultUri);
viewerModel.ExportSettings.UseSameTab = false;
return View(viewerModel);

See Also

ExportSettings Class

ExportSettings Members

DevExpress.XtraReports.Web.WebDocumentViewer.DataContracts Namespace