예제 #1
0
 private void CalculateMailMergeOptions(MergeSimpleDataForm form, MailMergeOptions options)
 {
     if (form.MergeRecords == MergeRecords.FromInterval)
     {
         options.FirstRecordIndex = Math.Max(0, ((MergeSimpleDataForm)form).StartIndex - 1);
         options.LastRecordIndex  = Math.Min(NorthwindDataProvider.Categories.Rows.Count - 1, ((MergeSimpleDataForm)form).EndIndex - 1);
     }
     else if (form.MergeRecords == MergeRecords.Current)
     {
         options.FirstRecordIndex = dataNavigator1.Position;
         options.LastRecordIndex  = dataNavigator1.Position;
     }
 }
예제 #2
0
        private void MergeToNewDocument()
        {
            MergeSimpleDataForm form = new MergeSimpleDataForm();

            if (form.ShowDialog(this) == DialogResult.OK)
            {
                MailMergeOptions options = richEditControl1.Document.CreateMailMergeOptions();

                CalculateMailMergeOptions(form, options);
                options.MergeMode = form.MergeMode;

                if (form.MergeDestination == MergeDestination.NewTab)
                {
                    MailMergeToNewControl(options);
                }
                else
                {
                    MailMergeToNewFile(options);
                }
            }
        }