Table of Contents

Getting started

This tutorial demonstrates how to get started with List & Label Cross Platform and covers both basic usage and advanced topics. We will walk through installing the package via NuGet, creating and configuring a ListLabel instance, setting up a data source, and exporting a report. In the advanced section, we explain logging, converting existing project files, and redistribution.


First steps

Installation via NuGet

To install List & Label Cross Platform, add a package reference to the combit.ListLabel31.CrossPlatform package from nuget.org. You can do this using the .NET CLI:

dotnet add package combit.ListLabel31.CrossPlatform

Creating an instance of ListLabel

After installing the package, you can create an instance of the ListLabel class. The snippet below shows how to initialize the ListLabel and set up some basic properties:

ListLabel listLabel = new ListLabel
{
    DataSource = GetNorthwindDataSet(),
    AutoProjectFile = projectFilePath,
    LicensingInfo = "..."
};

Explanation:

  • DataSource: Assigns a data source (for example, a DataSet with Northwind data). You can also use any of the supported data providers here. See Providing data.
  • AutoProjectFile: Points to the project file used for report definitions. When working with the Repository, you can use repository://<repositoryId> here.
  • LicensingInfo: Provides the licensing information needed for List & Label.

Setting the data source and additional properties

Make sure that your data source is properly set up. In the example above, GetNorthwindDataSet() is a placeholder for a method that returns a DataSet (or another supported data source) containing your data. You may also need to adjust additional properties based on your project requirements.

Exporting a report

Once your ListLabel instance is configured, you can export the report using an export configuration. Here's how to do it:

ExportConfiguration exportConfiguration = new ExportConfiguration(LlExportTarget.Pdf, exportFilePath, projectFilePath);
exportConfiguration.ShowResult = true;
listLabel.Export(exportConfiguration);

Explanation:

  • ExportConfiguration: Specifies the target format (PDF in this example), the export file path, and the project file path. You can also export to a Stream if required.
  • ShowResult: Determines whether to display the result after exporting.
  • Export: Executes the export process.

Advanced topics

Logging

Logging is essential for monitoring and troubleshooting report generation. For a basic setup, you can use the built-in DebwinLogger as shown below:

using DebwinLogger logger = new DebwinLogger("path/to/logfile.log", LogLevel.Info);
listLabel.Logger = logger;
Note

This basic configuration is ideal for getting started. For more advanced logging scenarios - including integration with other frameworks like Serilog and additional troubleshooting techniques - please refer to the Debugging and troubleshooting guide.

Converting existing project files

If you are transitioning from an older version or a different platform, you might need to convert your existing project files to be compatible with List & Label Cross Platform. Some key points to consider:

  • Backup: Always back up your existing project files before conversion.
  • Review: Compare the project settings and configurations, adjusting them as necessary for cross-platform compatibility.
  • Testing: After conversion, thoroughly test the reports to ensure that all elements render correctly.

Redistribution

When redistributing your application that uses List & Label Cross Platform:

  • Dependencies: Ensure that all necessary dependencies (such as the NuGet package and any runtime libraries) are included in your deployment package.
  • Optional dependencies: When deploying to Linux you'll have to reference the additional package SkiaSharp.NativeAssets.Linux.

Complete example

Below is the full snippet that ties together the topics discussed:

using DebwinLogger logger = new DebwinLogger(@"c:\logs\debwin4.log", LogLevel.Info);
ListLabel listLabel = new ListLabel
{
    Logger = logger,
    DataSource = GetNorthwindDataSet(), // Ensure you have a method that returns your DataSet
    AutoProjectFile = projectFilePath,   // Path to your project file
    LicensingInfo = "..."              // Your licensing key
};

ExportConfiguration exportConfiguration = new ExportConfiguration(LlExportTarget.Pdf, exportFilePath, projectFilePath);
exportConfiguration.ShowResult = true;
listLabel.Export(exportConfiguration);
Note
  • Replace GetNorthwindDataSet(), projectFilePath, and exportFilePath with your actual implementations or paths.
  • Use this example as a baseline and modify it according to your project's requirements.

Additional resources