combit List & Label 29 - .NET Hilfe
Einführung in die Programmierung / Tutorial / Praxisbeispiele
In diesem Thema
    Praxisbeispiele
    In diesem Thema

    Im Folgenden finden Sie eine Reihe von praxisnahen Beispielen für typische Anwendungsfälle mit List & Label.

     Design eines Etiketts aus einer XML-Datei

    Es wird mit Hilfe der Hauptfunktion Design ein Etiketten-Projekt im Designer geöffnet. Als verwendete Datenquelle wird eine XML-Datei verwendet.

    // Add List & Label namespaces
    using combit.Reporting;
    using combit.Reporting.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.Reporting
    Imports combit.Reporting.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 mit Optionen einer Liste mit Microsoft SQL Daten

    Die Hauptfunktion Print wird verwendet, um ein Listen-Projekt zu exportieren. Als Optionen wurde PDF als Standard-Exportformat definiert und der PDF-Autor auf "Max Mustermann" gesetzt. Als Datenquelle kommt eine Microsoft SQL Server Datenbank zum Einsatz.

    // Add List & Label namespaces
    using combit.Reporting;
    using combit.Reporting.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, "Max Mustermann");
       
        // Execute main function: Print
        LL.Print();
       
        // Post-Processing (optional)
        // Do nothing currently
    }
    
    ' Add List & Label namespaces
    Imports combit.Reporting
    Imports combit.Reporting.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, "Max Mustermann")
       
        ' Execute main function: Print
        LL.Print()
       
        ' Post-Processing (optional)
        ' Do nothing currently
    
    End Using 
    

     

     Stiller Export einer Liste aus Microsoft SQL Daten mit anschließendem eMail-Versand

    Über die Hauptfunktion Export wird ein Listen-Projekt mit Daten aus einer Microsoft SQL Server Datenbank in das PDF-Format exportiert. Als Nachbearbeitung wird nun das Export-Ergebnis direkt im Anschluss über den manuellen eMail-Versand von List & Label durchgeführt.

    // Add List & Label namespaces
    using combit.Reporting;
    using combit.Reporting.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.Reporting
    Imports combit.Reporting.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
    

     

     Weitere Beispiele
    Weitere Beispiele und Informationen finden Sie im nächsten Schritt Weiterführende Informationen.