Sehr geehrter Herr Kleinitzke,
Sie müssen LL.Variables.Add()
lediglich vor dem Aufruf von LL.Print()
bzw. vor dem Aufruf des Designers via LL.Design()
setzen. Der Beispielcode würde wie folgt aussehen:
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
'
Imports combit.Reporting
Imports combit.Reporting.DataProviders
Public Partial Class ListLabel27Report1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private Sub BtnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnPrint.Click
Try
' we need to 'free' the displayed preview file from preview control and detach the preview control from the List & Label component
previewControl.FileName = String.Empty
LL.PreviewControl = Nothing
LL.AutoShowPrintOptions = True
LL.AutoDestination = LlPrintMode.Export
LL.Variables.Add("Zusatzdaten.Projektname", GetCurrentProjectName());
LL.Print()
Catch exc As ListLabelException
MessageBox.Show(exc.Message, exc.Source, MessageBoxButtons.OK, MessageBoxIcon.[Error])
End Try
End Sub
Private Sub BtnDesign_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnDesign.Click
Try
LL.Variables.Add("Zusatzdaten.Projektname", GetCurrentProjectName());
LL.Design()
Catch exc As ListLabelException
MessageBox.Show(exc.Message, exc.Source, MessageBoxButtons.OK, MessageBoxIcon.[Error])
End Try
End Sub
Private Sub BtnExportTo_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnExportTo.Click
Try
' show FileOpenDialog to select the List & Label project file
Using openFileDlg As New OpenFileDialog()
openFileDlg.CheckFileExists = True
openFileDlg.CheckPathExists = True
openFileDlg.Filter = "Listenprojekt (*.lst)|*.lst"
If openFileDlg.ShowDialog() = DialogResult.OK Then
' prepare the export parameters
Dim projectFileName As String = openFileDlg.FileName
Dim exportFileName As String = System.IO.Path.Combine(System.IO.Path.GetTempPath(), "export.pdf")
Dim exportTarget As LlExportTarget = LlExportTarget.Pdf
' here you can specify other formats e.g. Xlsx
Dim exportConfiguration As New ExportConfiguration(exportTarget, exportFileName, projectFileName) With {
.ShowResult = True ' without any interaction set this property to false
}
' start exporting
LL.Export(exportConfiguration)
End If
End Using
Catch exc As ListLabelException
MessageBox.Show(exc.Message, exc.Source, MessageBoxButtons.OK, MessageBoxIcon.[Error])
End Try
End Sub
Private Sub BtnPrintToPreviewControl_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnPrintToPreviewControl.Click
Try
' we need to assign the preview control to the List & Label component to print directly into the preview control.
If LL.PreviewControl Is Nothing Then
LL.PreviewControl = previewControl
End If
LL.AutoShowPrintOptions = False
LL.AutoDestination = LlPrintMode.PreviewControl
LL.Variables.Add("Zusatzdaten.Projektname", GetCurrentProjectName());
LL.Print()
Catch exc As ListLabelException
MessageBox.Show(exc.Message, exc.Source, MessageBoxButtons.OK, MessageBoxIcon.[Error])
End Try
End Sub
End Class
Mit freundlichen Grüßen