Pass Additional Contents

If only a few variables or fields are to be added to the data of the data source, there are two possibilities:

  If the data is constant during the runtime of the report, it can just be added prior to the design or print call by using LL.Variables.Add.

  If the data changes from page to page or even from line to line, the information can be passed within the AutoDefineNewPage or AutoDefineNewLine events by using LL.Fields.Add or LL.Variables.Add.

The following example shows both approaches:

ListLabel LL = new ListLabel();
LL.DataSource = CreateDataSet();

 

// Define additional data fields

LL.Variables.Add("AdditionalData.UserName", GetCurrentUserName());

LL.Variables.Add("AdditionalData.ProjectName ", GetCurrentProjectName());

 

// Add event handling for own fields

LL.AutoDefineNewLine += new AutoDefineNewLineHandler(LL_AutoDefineNewLine);


// Call Designer
LL.Design();

 

// Print

LL.Print();

LL.Dispose();

 

 

void LL_AutoDefineNewLine(object sender, AutoDefineNewLineEventArgs e)

{

    // Switch to next record if necessary

    // GetCurrentFieldValue is function of your application

    // which returns the content of a data field.

    LL.Fields.Add("AdditionalData.AdditionalField", GetCurrentFieldValue());

}