Reports for WinForms | ComponentOne
Working with C1PrintDocument / Expressions, Scripts, Tags / Editing Tag Values at Run Time / Displaying All Tags
In This Topic
    Displaying All Tags
    In This Topic

    By default the ShowTagsInputDialog property is set to False and the Tags dialog box is not displayed. To allow the user to input all tags each time a C1PrintDocument is generated, set the ShowTagsInputDialog property to True on the document. Any tags you've added to the document's Tags collection will then be automatically presented in a dialog box to the user each time the document is about to be generated. This will give the end-user the opportunity to edit the tags values in the Tags dialog box.

    For example, the following code in the Form_Load event adds three tags to the document and text values for those tags:

    To write code in Visual Basic

    Visual Basic
    Copy Code
    Dim doc As New C1PrintDocument()
    Me.C1PrintPreviewControl1.Document = doc
    ' Show the Tags dialog box on document generation.
    doc.ShowTagsInputDialog = True
    ' Create tags that will be shown in the Tags dialog box.
    doc.Tags.Add(New C1.C1Preview.Tag("Statement", "Hello World!"))
    doc.Tags.Add(New C1.C1Preview.Tag("Name", "ComponentOne"))
    doc.Tags.Add(New C1.C1Preview.Tag("Location", "Pittsburgh, PA"))
    ' Add tags to the document and generate.
    Dim rt As New C1.C1Preview.RenderText()
    rt.Text = "[Statement] My name is [Name] and my current location is [Location]."
    doc.Body.Children.Add(rt)
    doc.Generate()
    

    To write code in C#

    C#
    Copy Code
    C1PrintDocument doc = new C1PrintDocument();
    this.c1PrintPreviewControl1.Document = doc;
    // Show the Tags dialog box on document generation.
    doc.ShowTagsInputDialog = true;
    // Create tags that will be shown in the Tags dialog box.
    doc.Tags.Add(new C1.C1Preview.Tag("Statement", "Hello World!"));
    doc.Tags.Add(new C1.C1Preview.Tag("Name", "ComponentOne"));
    doc.Tags.Add(new C1.C1Preview.Tag("Location", "Pittsburgh, PA"));
    // Add tags to the document and generate.
    C1.C1Preview.RenderText rt = new C1.C1Preview.RenderText();
    rt.Text = "[Statement] My name is [Name] and my current location is [Location].";
    doc.Body.Children.Add(rt);
    doc.Generate();
    

    When the application is run, the following dialog box is displayed before the document is generated:

    Changing the text in any of the textboxes in the Tags dialog box will change the text that appears in the generated document. If the default text is left, the following willproduce the following text in the generated document:

    Hello World! My name is ComponentOne and I'm currently located in Pittsburgh, PA.