Introduction
In the following we show how the printerless mode newly introduced with List & Label 27 can be activated for the Designer in a web application with only little effort.
Implementation
It is important to distinguish between the Web Designer for Windows and the fully browser-based Web Report Designer*. The sample code below is from the included ASP.NET MVC Web Reporting Sample which can be found in your List & Label installation in the following directory:
..\Samples\Microsoft .NET\.NET Framework 4\ASP.NET\C#\MVC Web Reporting Sample\
..\Samples\Microsoft .NET\.NET Core 3.1\ASP.NET\C#\MVC Web Reporting Sample\
Web Designer
Since the Web Designer for Windows is a standalone application, this mode must be passed to the client-side List & Label job via the Printerless
property (available as of Service Pack 27.004) of the WindowsClientWebDesignerOptions class. This happens in the file SampleController.cs
:
...
var options = new WindowsClientWebDesignerOptions
{
// Enable the printerless mode
Printerless = true,
// Load the data source matching the report.
// The second parameter (forDesign) can be used to specify a custom
// provider (e.g. with the property MinimalSelect = false) for the designer.
DataSource = GetDataSourceForProject(reportRepositoryID, false),
// The reference to the repository must be passed to List & Label
// to accept the repository ID of the project for 'AutoProjectFile'.
FileRepository = GetCurrentRepository(),
// Instead of the local file path, the repository ID is used when using
// repositories, i.e. the ID of the file in the repository is used instead of the local file path.
ProjectFile = reportRepositoryID,
ProjectType = RepositoryItemType.ToLlProject(GetCurrentRepository().GetItem(reportRepositoryID).Type)
};
...
Tip: See Use of the Web Designer to learn how to integrate the Web Designer for Windows and what to consider.
Web Report Designer
The fully browser-based Web Report Designer provides the method OnProvideListLabel for this purpose. In the file LLWebReportDesignerController.cs
, the printerless mode is enabled directly via the Printerless property of the List & Label object:
...
public override void OnProvideListLabel(ProvideListLabelContext provideListLabelContext)
{
// Create a new List & Label object for the Web Report Designer
ListLabel ll = DefaultSettings.GetListLabelInstance(provideListLabelContext.RepositoryId, null);
// Enable the printerless mode
ll.Printerless = true;
// Return newly created List & Label object
provideListLabelContext.NewInstance = ll;
}
...
Tip: See Use of the Web Report Designer to learn how to integrate the fully browser-based Web Report Designer and what to consider.