public ExportToWord(AddinSettings PobjSettings)
 {
     try
     {
         MobjSettings = PobjSettings;
     }
     catch (Exception PobjEx)
     {
         PobjEx.Log();
     }
 }
示例#2
0
 /// <summary>
 /// Load form - set Outlook application
 /// </summary>
 public PrintWhatForm(AddinSettings PobjSettings)
 {
     try
     {
         InitializeComponent();
         MobjOutlook = Globals.ThisAddIn.Application;
         Settings    = PobjSettings;
     }
     catch (Exception PobjEx)
     {
         PobjEx.Log(true, "Could not load print options form.");
         this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
     }
 }
示例#3
0
        /// <summary>
        /// Ask the user for the date they want to print with Today
        /// Selected by default. Then open Word, set the sheet size to 5x3,
        /// insert a table 2 columns a merged header (2 rows) and then
        /// proceed to fill it with the information from the calendar.
        /// Then open the Print Dialog for Word...
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonExport_Click(object PobjSender, RibbonControlEventArgs PobjEventArgs)
        {
            PrintWhatForm LobjDlg = null;

            try
            {
                AddinSettings LobjSettings = new AddinSettings();
                LobjSettings.LoadSettings();

                // show dialog
                LobjDlg = new PrintWhatForm(LobjSettings);
                if (LobjDlg.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
                {
                    return; // done
                }
                LobjSettings = LobjDlg.Settings;

                // save the settings
                LobjSettings.SaveSettings();

                // DO IT
                ExportToWord LobjExport = new ExportToWord(LobjSettings);
                if (LobjExport.Load())
                {
                    // load of items successful - export
                    LobjExport.Export();
                    // done
                    MessageBox.Show("Completed!", Common.APPNAME, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
            catch (Exception PobjEx)
            {
                PobjEx.Log(true, "There was an error exporting to Word.");
            }
            finally
            {
                if (MobjProgress != null)
                {
                    MobjProgress.Close();
                    MobjProgress = null;
                }
            }
        }