Esempio n. 1
0
        private void Save(object sender, EventArgs e)
        {
            try
            { if (NoPowerPoint())
              {
                  SaveFileDialog sfd = new SaveFileDialog {
                      Filter = powerpointformat
                  };
                  try
                  { if (sfd.ShowDialog() == DialogResult.OK)
                                {
                                    file_path = sfd.FileName;
                                }
                                else
                                {
                                    return;
                                } } catch (SystemException exc)
                  { MessageBox.Show(save_err_msg + sfd.FileName + ":\n\n" + exc);
                                return; } finally { sfd.Dispose(); }

                  CreateNewPresentation();
              }
              else
              {
                  foreach (var item in presentation.Slides[1].Shapes)
                  {
                      var shape = (Ppt.Shape)item;
                      if (shape.HasTextFrame != MsoTriState.msoTrue)
                      {
                          continue;
                      }

                      if (shape.Name == box_list[0])
                      {
                          shape.TextFrame.TextRange.Text = TitleBox.Text;
                      }

                      else if (box_list.Contains(shape.Name))
                      {
                          IDataObject clipped = Clipboard.GetDataObject();
                          BodyTextBox.SelectAll();
                          BodyTextBox.Copy();
                          shape.TextFrame.TextRange.Paste();
                          Clipboard.SetDataObject(clipped, true);
                      }
                  }
              }

              presentation.SaveAs(file_path); } catch (ArgumentException exc)
            { MessageBox.Show(save_err_msg + file_path + ":\n\n" + exc); }
        }
Esempio n. 2
0
        private void Write(object sender, EventArgs e)
        {
            bool new_presentation = NoPowerPoint();

            try
            { if (new_presentation)
              {
                  if (!CreateNewPresentation())
                  {
                      return;                                                                //If there is no presentation open create one, but return if the user cancels.
                  }
              }
              foreach (var item in presentation.Slides[1].Shapes)
              {
                  var shape = (Ppt.Shape)item;
                  if (shape.HasTextFrame != msoTrue)
                  {
                      continue;
                  }

                  if (shape.Name.Contains("Title"))
                  {
                      shape.TextFrame.TextRange.Text = TitleBox.Text;
                  }

                  else
                  {
                      IDataObject clipped = Clipboard.GetDataObject();
                      BodyTextBox.SelectAll();
                      BodyTextBox.Copy();
                      shape.TextFrame.TextRange.Paste();
                      Clipboard.SetDataObject(clipped, true);
                  }
              }

              if (new_presentation)
              {
                  try { presentation.SaveAs(file_path); }
                  catch (FileNotFoundException)
                  { MessageBox.Show(save_err_msg + file_path + " (invalid name)."); }
              }
              catch (System.Runtime.InteropServices.COMException exc)
              { MessageBox.Show(save_err_msg + file_path + ":\n\n" + exc); } } catch (System.Runtime.InteropServices.COMException exc)
Esempio n. 3
0
 private void QuickMailSender_Loaded(object sender, RoutedEventArgs e)
 {
     BodyTextBox.SelectAll();
     BodyTextBox.Focus();
 }