Skip to main content
You are viewing help content for a version that is no longer maintained/updated.
All docs
V21.2
  • SnapControl.MailMergeExportFormShowing Event

    Fires before showing the Export Range form.

    Namespace: DevExpress.Snap

    Assembly: DevExpress.Snap.v21.2.dll

    NuGet Package: DevExpress.Win.Snap

    Declaration

    public event MailMergeExportFormShowingEventHandler MailMergeExportFormShowing

    Event Data

    The MailMergeExportFormShowing event's data class is MailMergeExportFormShowingEventArgs. The following properties provide information specific to this event:

    Property Description
    DialogResult Gets or sets the return value of a dialog box. Inherited from ShowFormEventArgs.
    Handled Gets or sets whether an event was handled. If it was handled, the default actions are not required. Inherited from ShowFormEventArgs.
    Options Provides access to the mail merge options of the Export Range dialog window that is invoked when publishing a document.
    Parent Gets or sets a parent of the form being shown. Inherited from ShowFormEventArgs.

    Remarks

    The Export Range dialog window provides a user interface to specify the SnapMailMergeExportOptions. It is invoked after selecting the publishing format of a mail-merge document in the Data Tools: Mail Merge toolbar.

    snap-mail-merge-export-range-dialog

    Example

    This code snippet illustrates how to handle the SnapControl.MailMergeExportFormShowing event and specify the SnapMailMergeExportOptions.RecordSeparator and SnapMailMergeExportOptions.CustomSeparator properties to change the separator that is inserted between each pair of master sections.

    View Example

    // Provide a user interface to select a custom separator.
    private void snapControl1_MailMergeExportFormShowing(object sender, MailMergeExportFormShowingEventArgs e) {
    
        SnapMailMergeExportOptions eOptions = e.Options;
    
        MailMergeExportFormControllerParameters controllerParameters =
            new MailMergeExportFormControllerParameters(this.snapControl1, eOptions);
        eOptions.RecordSeparator = RecordSeparator.Custom;
        e.Handled = true;
    
        using (MyMailMergeExportForm mergeForm =
            new MyMailMergeExportForm(controllerParameters)) {
            mergeForm.LookAndFeel.ParentLookAndFeel = this.snapControl1.LookAndFeel;
            e.DialogResult = mergeForm.ShowDialog(this);
            switch (mergeForm.SeparatorType) {
                case MyMailMergeExportForm.SeparatorTypeEnum.Html:
                    eOptions.CustomSeparator.HtmlText = mergeForm.HtmlSeparator;
                    break;
                case MyMailMergeExportForm.SeparatorTypeEnum.RichText:
                    eOptions.CustomSeparator.Text = string.Empty;
                    eOptions.CustomSeparator.AppendDocumentContent(
                        mergeForm.RichSeparator.Range);
                    break;
            }
        }
    }
    
    See Also