Printing Labels

This sample program shows how to insert multiple text frames simultaneously. The application is a label printing program, used to print, for instance, address lables or badges. The source code for this sample program can be found in the TextFrames\Printing Address Lables directory.

The sample program contains a dialog box for entering information about the label sheet to be used, e.g. the number of lables and their dimensions.

The program then creates a text frame for each of the labels.

The text frames can them be filled out, either manually by clicking on a field and typing in text, or from a file or database. When you click on the Fill in menu item, the sample program will enter the words "Address no." followed by the field identifier into each of the frames.

To load text from a file instead, simply replace the Selection.Text property with a call to the Selection.Load method.

private void mnuLabel_FillIn_Click(object sender, System.EventArgs e)
    int n = 0;
    foreach (TXTextControl.TextFrame frame in textControl1.TextFrames) 
        frame.Selection.Text = "Text Frame #" + Convert.ToString(n++);
[Visual Basic]
Private Sub mnuLabel_FillIn_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles mnuLabel_FillIn.Click
    Dim N As Integer

    For Each Frame As TXTextControl.TextFrame In TextControl1.TextFrames
        Frame.Selection.Text = "Text Frame #" & N
        N = N + 1
End Sub
procedure TWinForm1.mnuLabel_FillIn_Click(sender: System.Object; e: System.EventArgs);
    n : Integer;
    Frame : TXTextControl.TextFrame;
    for Frame in TextControl1.TextFrames do begin
        Frame.Selection.Text := 'Text Frame #' + n.ToString();
        n := n + 1;

<< Previous