private void iktatasGroup_DialogLauncherClick(object sender, Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs e) { iktatasDialogForm iktatas_dialog = new iktatasDialogForm(); iktatas_dialog.setPath(); iktatas_dialog.Show(); }
private void Btn2_Click(object sender, Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs e) { Worksheet worksheet = (Worksheet)Globals.Factory.GetVstoObject(Globals.ThisAddIn.Application.ActiveWorkbook.Worksheets[1]); //Gets the cell - can also get a range of var cell = worksheet.Range["A1"]; lb1.Label = cell.Text; }
private void Btn1_Click(object sender, Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs e) { //Gets the first worksheet in the active workbook Worksheet worksheet = (Worksheet)Globals.Factory.GetVstoObject(Globals.ThisAddIn.Application.ActiveWorkbook.Worksheets[1]); //Inserts into a cell worksheet.Cells[1, 1] = eb1.Text; }
//Logout button click event private void BtnLogout_Click(object sender, Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs e) { Properties.Settings.Default.LoginStatus = "LoggedOut"; Properties.Settings.Default.Save(); menuButton1.Items.Clear(); menuButton1.Items.Add(btnLogin); MessageBox.Show("You have been Logged out successfully"); }
public void getMail_Click(object sender, Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs e) { if (Properties.Settings.Default.username == "" || Properties.Settings.Default.adress == "" || Properties.Settings.Default.password == "") { MessageBox.Show("Giriş Yapınız"); } else { Microsoft.Office.Interop.Outlook.Explorer explorer = Globals.ThisAddIn.Application.ActiveExplorer(); if (explorer != null) { Object obj = explorer.Selection[1]; if (obj is Microsoft.Office.Interop.Outlook.MailItem) { Microsoft.Office.Interop.Outlook.MailItem item = (obj as Microsoft.Office.Interop.Outlook.MailItem); var client = new RestClient(Form1.adress + "/api/values/zmailinfo"); client.Timeout = -1; var request = new RestRequest(Method.POST); request.AddParameter("MailSubject", item.Subject); request.AddParameter("MailBody", item.Body); request.AddParameter("FromEmail", item.SenderEmailAddress); request.AddParameter("ToEmail", item.To); request.AddParameter("CcEmail", item.CC); request.AddParameter("BccEmail", item.BCC); request.AddParameter("EntryId", item.EntryID); IRestResponse response = client.Execute(request); ResultModel <string> model = null; if (response.StatusCode == HttpStatusCode.OK) { model = JsonConvert.DeserializeObject <ResultModel <string> >(response.Content); } if (model != null) { if (model.succeed) { MessageBox.Show("E-mail CRM uygulamanıza gönderildi"); } else { MessageBox.Show("Gönderilemedi."); } } else { MessageBox.Show("Hata Alındı. Hata Kodu: " + response.StatusCode.ToString()); } } } } }
//Converts a workbook and worksheet to a CSV file private void Btn1_Click(object sender, Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs e) { //Saves the workbook as a CSV file Workbook workbook = (Workbook)Globals.Factory.GetVstoObject(Globals.ThisAddIn.Application.ActiveWorkbook); workbook.SaveAs(@"C:\Users\Kent\Desktop\Coding\apps\ExcelAddIn\Basics\Advanced\test.csv", Microsoft.Office.Interop.Excel.XlFileFormat.xlCSV); //Saves the worksheet as a CSV file Worksheet worksheet = (Worksheet)Globals.Factory.GetVstoObject(Globals.ThisAddIn.Application.ActiveWorkbook.Worksheets[1]); worksheet.SaveAs(@"C:\Users\Kent\Desktop\Coding\apps\ExcelAddIn\Basics\Advanced\test2.csv", Microsoft.Office.Interop.Excel.XlFileFormat.xlCSV); }
//Calculates the sum of column E and F private void Btn2_Click(object sender, Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs e) { Worksheet worksheet = (Worksheet)Globals.Factory.GetVstoObject(Globals.ThisAddIn.Application.ActiveWorkbook.Worksheets[1]); //Integer for number of rows int lastRow = worksheet.Cells.Find("*", System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, Microsoft.Office.Interop.Excel.XlSearchOrder.xlByRows, Microsoft.Office.Interop.Excel.XlSearchDirection.xlPrevious, false, System.Reflection.Missing.Value, System.Reflection.Missing.Value).Row; //At cell[lastRow+1,2] it writes =SUM(E1:Ex) which is Excel formula for calculate sum for E-column worksheet.Cells[lastRow + 1, 5] = "=SUM(E2:E" + lastRow + ")"; //Does the same for column F worksheet.Cells[lastRow + 1, 6] = "=SUM(F2:F" + lastRow + ")"; }
//Login button click event private void BtnLogin_Click(object sender, Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs e) { //Navigate to login form LoginForm loginForm = new LoginForm(); loginForm.ShowDialog(); //After succesfull login changes the menu item if (LoginForm.IsLoginSuccess) { menuButton1.Items.Clear(); menuButton1.Items.Add(btnLogout); } }
//Calculates the sum of a user chosen column private void Btn3_Click(object sender, Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs e) { Worksheet worksheet = (Worksheet)Globals.Factory.GetVstoObject(Globals.ThisAddIn.Application.ActiveWorkbook.Worksheets[1]); //Integer for number of rows int lastRow = worksheet.Cells.Find("*", System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, Microsoft.Office.Interop.Excel.XlSearchOrder.xlByRows, Microsoft.Office.Interop.Excel.XlSearchDirection.xlPrevious, false, System.Reflection.Missing.Value, System.Reflection.Missing.Value).Row; //Gets the userinput for which colum to calculate sum from var columnToPopulate = eb1.Text; //We have our headers so the first cell we'll calculate from is Users Choice + 2 i.e. G2 var firstCell = columnToPopulate + "2"; //Our last cell will be the chosen column and then the last row i.e. G16 var lastCell = columnToPopulate + lastRow; //Here we populate i.e. Cell[17, G] will calculate formulate =SUM(G2:G16) worksheet.Cells[lastRow + 1, columnToPopulate] = "=SUM(" + firstCell + ":" + lastCell + ")"; }
private void menu1_ItemsLoading(object sender, Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs e) { // Had to add the following condition because everytime the Menu was accessed, // the ItemsLoading event kept getting fired and the would keep adding the same // menu items over and over again!!!! if (menuItemsLoaded == false) { if (SHOW_SETTINGS_PROPERTY == true) { RibbonButton menuButton1 = Factory.CreateRibbonButton(); menuButton1.Label = "&Secure Email Settings"; menuButton1.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler( secureEmailSettingsForm_Click); menu1.Items.Add(menuButton1); } RibbonButton menuButton2 = Factory.CreateRibbonButton(); menuButton2.Label = "Secure Email Information"; menuButton2.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler( secureEmailInformation_Click); menu1.Items.Add(menuButton2); RibbonButton menuButton3 = Factory.CreateRibbonButton(); menuButton3.Label = "About"; menuButton3.Click += new Microsoft.Office.Tools.Ribbon.RibbonControlEventHandler( secureEmailAboutForm_Click); menu1.Items.Add(menuButton3); menuItemsLoaded = true; } }
void cc_btn_Click(object sender, Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs e) { CCLicense cl = new CCLicense(); cl.Show(); }
private void login_Click(object sender, Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs e) { Form1 form = new Form1(); form.Show(); }
private void buttonMNB_Click(object sender, Microsoft.Office.Tools.Ribbon.RibbonControlEventArgs e) { mNB.GetData(); access.PutInfoToAccess(); }