Example #1
0
        private void item_Click(object sender, EventArgs e)
        {
            ObjectInfo info = (sender as ToolStripMenuItem).Tag as ObjectInfo;

            if (info == null)
            {
                preview.Save();
            }
            else
            {
                ExportBase export = Activator.CreateInstance(info.Object) as ExportBase;
                export.CurPage = preview.PageNo;
                export.Export(preview.Report);
            }
        }
Example #2
0
        private void Email_Click(object sender, EventArgs e)
        {
            if (IsPreviewEmpty)
            {
                return;
            }

            List <string> fileNames = new List <string>();
            ObjectInfo    info      = (sender as ButtonItem).Tag as ObjectInfo;

            if (info == null)
            {
                using (SaveFileDialog dialog = new SaveFileDialog())
                {
                    dialog.Filter     = Res.Get("FileFilters,PreparedReport");
                    dialog.DefaultExt = "*.fpx";
                    if (dialog.ShowDialog() == DialogResult.OK)
                    {
                        Save(dialog.FileName);
                        fileNames.Add(dialog.FileName);
                    }
                }
            }
            else
            {
                ExportBase export = Activator.CreateInstance(info.Object) as ExportBase;
                export.CurPage        = CurrentPreview.PageNo;
                export.AllowOpenAfter = false;
                export.ShowProgress   = true;
                export.Export(Report);
                fileNames = export.GeneratedFiles;
            }

            if (fileNames.Count > 0)
            {
                Form     form = FindForm();
                string[] recipientAddresses = Report.EmailSettings.Recipients == null ?
                                              new string[] { } : Report.EmailSettings.Recipients;
                int error = MAPI.SendMail(form == null ? IntPtr.Zero : form.Handle, fileNames.ToArray(),
                                          Report.EmailSettings.Subject, Report.EmailSettings.Message, new string[] {}, recipientAddresses);
                if (error > 1)
                {
                    MessageBox.Show("MAPISendMail failed! " + MAPI.GetErrorText(error));
                }
            }
        }
Example #3
0
        private void Export_Click(object sender, EventArgs e)
        {
            if (IsPreviewEmpty)
            {
                return;
            }

            ObjectInfo info = (sender as ButtonItem).Tag as ObjectInfo;

            if (info == null)
            {
                Save();
            }
            else
            {
                ExportBase export = Activator.CreateInstance(info.Object) as ExportBase;
                export.CurPage           = CurrentPreview.PageNo;
                export.AllowSaveSettings = true;
                export.ShowProgress      = true;
                try
                {
                    export.Export(Report);
                }
#if !DEBUG
                catch (Exception ex)
                {
                    using (ExceptionForm form = new ExceptionForm(ex))
                    {
                        form.ShowDialog();
                    }
                }
#endif
                finally
                {
                }
            }
        }