Specify File Name for Export as Formula in Project File

With the help of the project parameters (see also ProjectParameter), information can be quickly and easily saved in projects and read out again. These must not only be fixed defined contents, but could also be dynamically derived from the data source in the context of flexible formulas based on the variables used.

In order to demonstrate this, one could assume that the file name for the export with List & Label should be based on information from the used project file and data source.

Step 1:
First, a corresponding ProjectParameter must be created for List & Label:

ProjectParameter myProjectParameter = LL.ProjectParameters.NewParameter("ExportFileName");
myProjectParameter.Category = LlProjectParameterCategory.User;
myProjectParameter.Scope = LlProjectParameterScope.Global;
myProjectParameter.Visibility = LlProjectParameterVisibility.Public;
myProjectParameter.ParameterType = LlProjectParameterType.Formula;
myProjectParameter.Value = "";

The new project parameter is then available in the Designer and can be assigned a formula accordingly:


Step 2:
In order to use the evaluated content of the project parameter “ExportFileName” for the later export, it must be determined at a suitable time and used as an export option. The Event DefinePrintOptions is suitable for this.

Define event and trigger print/export:
LL.DefinePrintOptions += LL_DefinePrintOptions;
Implementation of the event with the resolved project parameter: private void LL_DefinePrintOptions(object sender, EventArgs e)
    string val = myParam.EvaluatedValue;
    if (!string.IsNullOrEmpty(val))
        ListLabel currentLL = sender as ListLabel;
        currentLL.ExportOptions.Add(LlExportOption.ExportFile, val);

And this is how it would look for the user:


But of course this can also be done automatically with the help of the ExportConfiguration class.