Export Without User Interaction Using OCX / VCL or .NET Component

Valid from List & Label 9
Performing an export without any user interaction can be done by setting the appropriate "Export." options.

Due to the fact that the print method resets all printing options, you have to set the print option string LL_PRNOPTSTR_EXPORT in an event or callback when using the VCL, OCX or .NET component's print method.

Starting with List & Label 10, you'll find a sample each for VB, .NET and Delphi.
 

Visual Basic

An example in Visual Basic:

Private Sub ListLabel1_CmndSetPrintOptions(ByVal nUserData As Long, pnPrintMethodOptionFlags As ListLabel.LlCmndSetPrintOptionsConstants)
ListLabel1.LlXSetParameter LL_LLX_EXTENSIONTYPE_EXPORT, "PDF", "Export.File", "export.pdf" 'Filename
ListLabel1.LlXSetParameter LL_LLX_EXTENSIONTYPE_EXPORT, "PDF", "Export.Path", "c:\temp" 'Path
ListLabel1.LlXSetParameter LL_LLX_EXTENSIONTYPE_EXPORT, "PDF", "Export.Quiet", "1"
ListLabel1.LlPrintSetOptionString LL_PRNOPTSTR_EXPORT, "PDF"
End Sub 

Delphi

The same example in Delphi (Event: OnSetPrintOptions) :

procedure TForm1.ll_1SetPrintOptions(Sender: TObject; 
var PrintMethodOptionFlags: Integer);

begin
    ll_1.LlXSetParameter(LL_LLX_EXTENSIONTYPE_EXPORT, 'PDF', 'Export.File', 'export.pdf');
    ll_1.LlXSetParameter(LL_LLX_EXTENSIONTYPE_EXPORT, 'PDF', 'Export.Path', 'C:\temp');
    ll_1.LlXSetParameter(LL_LLX_EXTENSIONTYPE_EXPORT, 'PDF', 'Export.Quiet', '1');
    ll_1.LlPrintSetOptionString(LL_PRNOPTSTR_EXPORT, 'PDF');
end; 

.NET

Starting with version 11, the options can easily be set using the ExportOptions collection. The provided sample demonstrates this.

With older versions, the additional options can be set in the DefinePrintOptions event. The event is triggered internally after LlPrintWithBoxStart but before the actual printing occurs. The event does not contain any additional event arguments.
Sample listing:

private void LL_DefinePrintOptions(object sender, System.EventArgs e)
{
    LL.Core.LlPrintSetOptionString(LlPrintOptionString.Export, "PDF");
    LL.Core.LlXSetParameter(LlExtensionType.Export, "PDF", "Export.File", "export.pdf");
    LL.Core.LlXSetParameter(LlExtensionType.Export, "PDF", "Export.Path", "c:\\temp");
    LL.Core.LlXSetParameter(LlExtensionType.Export, "PDF", "Export.Quiet", "1");
}


Since the Version 17 you can use the class ExportConfiguration and the method Export(…)
from the ListLabel object to export without user interaction: Example:


ExportConfiguration cfg = new ExportConfiguration(LlExportTarget.Pdf, "c:\\temp\export.pdf", "export.lst");
LL.Export(cfg);


Please also refer to the Programmer’s Reference.

IDKBTE000612 KBTE000612