combit List & Label 24 - .NET Online Web Help
Examples
Programming Introduction > Tutorial > Examples

 

Fundamentals

 

Practical Examples

 

Further Information

 

Below you will find a number of practical examples for typical applications with List & Label.

 Designing a Label from an XML File

A label project is opened in the Designer using the main Design function. An XML file is used as the data source.

// Add List & Label namespaces
using combit.ListLabel[Versionsnummer];
using combit.ListLabel[Versionsnummer].DataProviders;

...

// Create List & Label object
using(ListLabel LL = new ListLabel())
{
    // Licensing the List & Label component
    LL.LicensingInfo = "xXxXxXxX";
 
    // Identify the data source
    XmlDataProvider xmlProvider = new XmlDataProvider(@"C:\temp\customers.xml");
    LL.DataSource = xmlProvider;
    LL.DataMember = "Customers";
 
    // Define project type
    LL.AutoProjectType = LlProject.Label;
 
    // Define some options (optional)
    // No more options to define
   
    // Execute main function: Design
    LL.Design();
   
    // Post-Processing (optional)
    // Do nothing currently
}
' Add List & Label namespaces
Imports combit.ListLabel[Versionsnummer]
Imports combit.ListLabel[Versionsnummer].DataProviders

...

' Create List & Label object
Using LL As New ListLabel()

    ' Licensing the List & Label component
    LL.LicensingInfo = "xXxXxXxX"
 
    ' Identify the data source
    Dim xmlProvider As New XmlDataProvider(@"C:\temp\customers.xml")
    LL.DataSource = xmlProvider
    LL.DataMember = "Customers"
 
    ' Define project type
    LL.AutoProjectType = LlProject.Label
 
    ' Define some options (optional)
    ' No more options to define
    
    ' Execute main function: Design
    LL.Design()
    
    ' Post-Processing (optional)
    ' Do nothing currently

End Using 

 

 PDF export with options for a list of data from Microsoft SQL

The main function Print is used to export a list project. PDF was defined as the standard export format and the PDF author was set to "John Doe" as options. A Microsoft SQL Server database is used as data source.

// Add List & Label namespaces
using combit.ListLabel[Versionsnummer];
using combit.ListLabel[Versionsnummer].DataProviders;

...

// Create List & Label object
using(ListLabel LL = new ListLabel())
{
    // Licensing the List & Label component
    LL.LicensingInfo = "xXxXxXxX";
 
    // Identify the data source
    SqlConnection connection = new SqlConnection(Properties.Settings.Default.ConnectionString);
    SqlConnectionDataProvider sqlProvider = new SqlConnectionDataProvider(connection);
    LL.DataSource = sqlProvider;
 
    // Define project type
    LL.AutoProjectType = LlProject.List;
 
    // Define some options (optional)
    LL.ExportOptions.Add(LlExportOption.ExportTarget, "PDF");
    LL.ExportOptions.Add(LlExportOption.PdfAuthor, "John Doe");
   
    // Execute main function: Print
    LL.Print();
   
    // Post-Processing (optional)
    // Do nothing currently
}
' Add List & Label namespaces
Imports combit.ListLabel[Versionsnummer]
Imports combit.ListLabel[Versionsnummer].DataProviders

...

' Create List & Label object
Using LL As New ListLabel()

    ' Licensing the List & Label component
    LL.LicensingInfo = "xXxXxXxX"
 
    ' Identify the data source
    Dim connection As New SqlConnection(Properties.Settings.Default.ConnectionString)
    Dim sqlProvider As New SqlConnectionDataProvider(connection)
    LL.DataSource = sqlProvider
 
    ' Define project type
    LL.AutoProjectType = LlProject.List
 
    ' Define some options (optional)
    LL.ExportOptions.Add(LlExportOption.ExportTarget, "PDF")
    LL.ExportOptions.Add(LlExportOption.PdfAuthor, "John Doe")
   
    ' Execute main function: Print
    LL.Print()
   
    ' Post-Processing (optional)
    ' Do nothing currently

End Using 

 

 Silent export of a list from Microsoft SQL data with subsequent e-mail sending
main function Export exports a list project with data from a Microsoft SQL Server database into PDF format. As Post-Processing, the export result is now carried out directly afterwards via the manual e-mail sending of List& Label.

// Add List & Label namespaces
using combit.ListLabel[Versionsnummer];
using combit.ListLabel[Versionsnummer].DataProviders;

...

// Create List & Label object
using(ListLabel LL = new ListLabel())
{
    // Licensing the List & Label component
    LL.LicensingInfo = "xXxXxXxX";
 
    // Identify the data source
    SqlConnection connection = new SqlConnection(Properties.Settings.Default.ConnectionString);
    SqlConnectionDataProvider sqlProvider = new SqlConnectionDataProvider(connection);
    LL.DataSource = sqlProvider;
 
    // Define project type
    LL.AutoProjectType = LlProject.List;
 
    // Define some options (optional)
    // No more options to define
   
    // Execute main function: Export
    string exportFilename = @C:\temp\export.pdf";
    ExportConfiguration exportConfiguration = new ExportConfiguration(LlExportTarget.Pdf, exportFilename, "simple.lst");
    LL.Export();
   
    // Post-Processing (optional): Sending eMail manual with List & Label
    using(MailJob mailJob = new MailJob())
    {
        mailJob.AttachmentList.Add(exportFilename);
        mailJob.To = "info@combit.net";
        mailJob.Subject = "Here is the report";
        mailJob.Body = "Please note the attachment.";
        mailJob.Provider = "XMAPI";
        mailJob.ShowDialog = true;
        mailJob.Send();
    }
}
' Add List & Label namespaces
Imports combit.ListLabel[Versionsnummer]
Imports combit.ListLabel[Versionsnummer].DataProviders

...

' Create List & Label object
Using LL As New ListLabel()

    ' Licensing the List & Label component
    LL.LicensingInfo = "xXxXxXxX"
 
    ' Identify the data source
    Dim connection As New SqlConnection(Properties.Settings.Default.ConnectionString)
    Dim sqlProvider As New SqlConnectionDataProvider(connection)
    LL.DataSource = sqlProvider
 
    ' Define project type
    LL.AutoProjectType = LlProject.List
 
    ' Define some options (optional)
    ' No more options to define
   
    ' Execute main function: Export
    Dim exportFilename As String = "@C:\temp\export.pdf"
    Dim exportConfiguration As New ExportConfiguration(LlExportTarget.Pdf, exportFilename, "simple.lst")
    LL.Export()
   
    ' Post-Processing (optional): Sending eMail manual with List & Label
    Using mailJob As New MailJob()
   
        mailJob.AttachmentList.Add(exportFilename)
        mailJob.To = "info@combit.net"
        mailJob.Subject = "Here is the report"
        mailJob.Body = "Please note the attachment."
        mailJob.Provider = "XMAPI"
        mailJob.ShowDialog = true
        mailJob.Send()
       
    End Using
   
End Using

 

 Further examples
Further examples and information can be found in the next step Further Informations.