WebDocumentViewerConfigurationBuilder.UseFileExportedDocumentStorage(String) Method
Enables exported document file storage and specifies a storage path.
Namespace: DevExpress.AspNetCore.Reporting
Assembly: DevExpress.AspNetCore.Reporting.v24.2.dll
NuGet Package: DevExpress.AspNetCore.Reporting
Declaration
public WebDocumentViewerConfigurationBuilder UseFileExportedDocumentStorage(
string workingDirectory
)
Parameters
Name | Type | Description |
---|---|---|
workingDirectory | String | Specifies a path to store the exported documents. |
Returns
Type | Description |
---|---|
WebDocumentViewerConfigurationBuilder | A WebDocumentViewerConfigurationBuilder that can be used to adjust the Web Document Viewer services. |
Remarks
The Document Viewer uses a memory cache or file storage for the exported document in the following cases:
- an asynchronous export mode is enabled (the AsyncExportApproach is set to true);
- content editing is enabled in the exported document;
- the Document Viewer displays a document from the ReportServer.
The exported document is stored in a memory cache and removed from it the first time it is requested. To force the Document Viewer to use a file storage, call the UseFileExportedDocumentStorage method.
The following code demonstrates how to use the UseFileExportedDocumentStorage method to specify a file storage for the Document Viewer.
using DevExpress.AspNetCore;
using DevExpress.AspNetCore.Reporting;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddDevExpressControls();
builder.Services.AddMvc();
builder.Services.ConfigureReportingServices(configurator => {
configurator.ConfigureWebDocumentViewer(viewerConfigurator => {
viewerConfigurator.UseFileExportedDocumentStorage(System.IO.Path.Combine(builder.Environment.ContentRootPath, "ExportedDocumentStorage" ));
});
});
var app = builder.Build();
Tip
If you use Web Farms or Garden, switch to the InterProcess synchronization mode (the default mode is InterThread). For this, call the WebDocumentViewerConfigurationBuilder.UseFileExportedDocumentStorage method with the StorageSynchronizationMode.InterProcess parameter.
The cleaner service periodically searches the cache and file storage for expired documents/exported documents/reports and deletes them. You can use the CacheCleanerSettings and StorageCleanerSettings to specify check interval and expiration time settings. To prevent expired documents from being deleted, call the UseEmptyStoragesCleaner() method to register an empty storage cleaner.