public void btnSyncField_Click(Microsoft.Office.Core.IRibbonControl control) { var doc = new OfficeDocument(Globals.ThisAddIn.Application.ActiveDocument); var proptectionType = -1; try { proptectionType = doc.TurnOffProtection(String.Empty); var contentcontrol = Globals.ThisAddIn.Application.Selection.Range.ParentContentControl; if (contentcontrol == null) { return; } var matchingControls = Globals.ThisAddIn.Application.ActiveDocument.SelectContentControlsByTag(contentcontrol.Tag); foreach (WordOM.ContentControl mc in matchingControls) { mc.Range.Text = contentcontrol.Range.Text; } } catch (Exception e) { var logger = new EventViewerLogger(); logger.Log(e.ToString(), BusinessLogic.Interfaces.Logging.Type.Error); #if DEBUG MessageBox.Show(e.ToString(), @"sorry"); #endif } finally { doc.TurnOnProtection(proptectionType, String.Empty); } }
public Bitmap GetImage(Microsoft.Office.Core.IRibbonControl control) { switch (control.Id) { case "btnHelp": { return(new Bitmap(Properties.Resources.Help)); } case "btnWizard": { return(new Bitmap(Properties.Resources.Wizard)); } case "btnConvertPDF": { return(new Bitmap(Properties.Resources.pdf)); } case "btnUpdateFields": { return(new Bitmap(Properties.Resources.calculator)); } } return(null); }
public void btnLock_Click(Microsoft.Office.Core.IRibbonControl control) { foreach (WordOM.Table table in Globals.ThisAddIn.Application.ActiveDocument.Tables) { try { var controls = table.Range.ContentControls; if (controls == null || controls.Count == 0) { continue; } table.Select(); Globals.ThisAddIn.Application.Selection.Range.ContentControls.Add(WordOM.WdContentControlType.wdContentControlGroup); } catch (Exception e) { #if DEBUG MessageBox.Show(e.ToString(), @"sorry"); #endif } } var storedMode = Globals.ThisAddIn.Application.ActiveDocument.GetPropertyValue(Constants.WordDocumentProperties.ToggleLockMode); var newMode = String.Equals(storedMode, Constants.WordDocumentPropertyValues.ToggleLockModeUnlocked) ? Constants.WordDocumentPropertyValues.ToggleLockModeLocked : Constants.WordDocumentPropertyValues.ToggleLockModeUnlocked; Globals.ThisAddIn.Application.ActiveDocument.UpdateOrCreatePropertyValue(Constants.WordDocumentProperties.ToggleLockMode, newMode); ribbon.Invalidate(); }
public void btnTableConfigure_Click(Microsoft.Office.Core.IRibbonControl control) { FormTableOption formTableOption = new FormTableOption(); formTableOption.ShowDialog(); ribbon.Invalidate(); }
public void btnSyncTable_Click(Microsoft.Office.Core.IRibbonControl control) { var doc = new OfficeDocument(Globals.ThisAddIn.Application.ActiveDocument); var proptectionType = -1; try { //proptectionType = doc.TurnOffProtection(String.Empty); var tables = Globals.ThisAddIn.Application.Selection.Tables; if (tables == null || tables.Count == 0) { MessageBox.Show(@"Please ensure your cursor is within a table", @"No Table Found", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } var table = tables[1]; var contentcontrols = table.Range.ContentControls; if (contentcontrols == null) { return; } foreach (WordOM.ContentControl contentControl in contentcontrols) { if (String.IsNullOrEmpty(contentControl.Tag)) { continue; } var matchingControls = Globals.ThisAddIn.Application.ActiveDocument.SelectContentControlsByTag(contentControl.Tag); foreach (WordOM.ContentControl mc in matchingControls) { mc.Range.Text = contentControl.Range.Text; } } } catch (Exception e) { var logger = new EventViewerLogger(); logger.Log(e.ToString(), BusinessLogic.Interfaces.Logging.Type.Error); #if DEBUG MessageBox.Show(e.ToString(), @"sorry"); #endif } finally { // doc.TurnOnProtection(proptectionType, String.Empty); } }
public bool btnSyncTable_GetEnabled(Microsoft.Office.Core.IRibbonControl control) { if (Globals.ThisAddIn.Application.Documents.Count < 1) { return(false); } var templateName = ((DocumentProperties)(Globals.ThisAddIn.Application.ActiveDocument.BuiltInDocumentProperties))[WordOM.WdBuiltInProperty.wdPropertyTitle].Value.ToString(); return(String.Equals(templateName, Constants.TemplateNames.PreRenewalQuestionnaire)); }
/// <summary> /// Renvoi une image à l'appelant pour un bouton. /// </summary> /// <param name="control"></param> /// <returns></returns> public System.Drawing.Bitmap GetImage(Microsoft.Office.Core.IRibbonControl control) { switch (control.Id) { // Backstage case "taskCatFiles": return(Properties.Resources.FileManagement64); case "btnProjectNew": return(Properties.Resources.ProjectNew64); case "btnProjectOpen": return(Properties.Resources.ProjectOpen64); case "btnProjectSave": return(Properties.Resources.ProjectSave64); case "btnProjectSaveAs": return(Properties.Resources.ProjectSaveAs64); case "btnProjectClose": return(Properties.Resources.ProjectClose64); // Ruban case "btnApplyShapeData": // Application des données de forme return(Properties.Resources.ApplyShapeData); case "btnSceneGenerateWithBabylonJS": // BabylonJS in Popup Window return(Properties.Resources.Vue3D32); case "btnWindowSceneGenerateWithBabylonJS": // BabylonJS in panel Window return(Properties.Resources.Panel3D32); default: break; //case "buttonGetHelp": // { // return Properties.Resources.SelfSupportPH; // } //case "buttonTemplate1": //case "imageControl1": // { // return Properties.Resources.TemplateIcon1; // } } // we should not get here for these buttons return(null); }
public void btnHelp_Click(Microsoft.Office.Core.IRibbonControl control) { var wizard = new HelpWizard() { TopMost = true, StartPosition = FormStartPosition.CenterParent }; #if DEBUG wizard.TopMost = false; #endif wizard.Show(); }
public void btnUpdateFields_Click(Microsoft.Office.Core.IRibbonControl control) { var tableCount = SummaryTableCount(); if (tableCount != 1) { MessageBox.Show(String.Format("There is {0} no {1} table in this document.", tableCount, Constants.WordTables.RenewalReportPremiumSummary), @"No changes made.", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } Globals.ThisAddIn.Application.ActiveDocument.Fields.Update(); CalculatePremSummaryTable(); SyncPremiumSummaryTable(); }
public void btnHelp_Click(Microsoft.Office.Core.IRibbonControl control) { var templateName = ((DocumentProperties)(Globals.ThisAddIn.Application.ActiveDocument.BuiltInDocumentProperties))[ WordOM.WdBuiltInProperty.wdPropertyTitle].Value.ToString(); var wizard = new HelpWizard(templateName) { TopMost = true, StartPosition = FormStartPosition.CenterParent }; #if DEBUG wizard.TopMost = false; #endif wizard.Show(); }
public bool GetEnabled(Microsoft.Office.Core.IRibbonControl control) { bool bRetour = true; switch (control.Id) { case "btnNew": { bRetour = true; break; } default: break; } return(bRetour); }
public string GetLabel(Microsoft.Office.Core.IRibbonControl control) { Assembly applicationAssembly; string strVersion = "", strVersions = ""; switch (control.Id) { case "labelBuildInfo": applicationAssembly = Assembly.GetCallingAssembly(); strVersion = "Version : " + applicationAssembly.GetName().Version.ToString(); break; default: break; } return(strVersion); }
public void btnConvertPDF_Click(Microsoft.Office.Core.IRibbonControl control) { Process.Start(@"C:\Program Files\Free PDF Solutions\FreePDFSolutions_PDF2Word.exe"); }
public void btnWizard_Click(Microsoft.Office.Core.IRibbonControl control) { Globals.ThisAddIn.Application.ActiveDocument.LoadWizard(Enums.FormLoadType.RibbonClick); }
//ここにコールバック メソッドを作成します。コールバック メソッドの追加の詳細については、ソリューション エクスプローラーでリボンの XML アイテムを選択し、F1 キーを押してください public void btnConfigure_Click(Microsoft.Office.Core.IRibbonControl control) { FormOption formOption = new FormOption(); formOption.ShowDialog(); }
public void btnUpdateFields_Click(Microsoft.Office.Core.IRibbonControl control) { Globals.ThisAddIn.Application.ActiveDocument.Fields.Update(); CalculatePremSummaryTable(); }
public void btnAbout_Click(Microsoft.Office.Core.IRibbonControl control) { var about = new About(); about.ShowDialog(); }
public Bitmap GetImage(Microsoft.Office.Core.IRibbonControl control) { switch (control.Id) { case "btnHelp": { return(new Bitmap(Properties.Resources.Help)); } case "btnToggleLock": { return(new Bitmap(Properties.Resources.Lock)); } case "btnTogleLockUnlock": { var mode = Globals.ThisAddIn.Application.ActiveDocument.GetPropertyValue(Constants.WordDocumentProperties.ToggleLockMode); return(String.Equals(mode, Constants.WordDocumentPropertyValues.ToggleLockModeLocked, StringComparison.OrdinalIgnoreCase) ? new Bitmap(Properties.Resources.Unlock) : new Bitmap(Properties.Resources.Lock)); } case "btnTogleUnlock": { return(new Bitmap(Properties.Resources.Unlock)); } case "btnHelpHome": { return(new Bitmap(Properties.Resources.Help)); } case "btnSyncField": { return(new Bitmap(Properties.Resources.SyncField)); } case "btnSyncTableHome": { return(new Bitmap(Properties.Resources.SyncTableInfo)); } case "btnSyncTable": { return(new Bitmap(Properties.Resources.SyncTableInfo)); } case "btnWizard": { return(new Bitmap(Properties.Resources.Wizard)); } case "btnWizardHome": { return(new Bitmap(Properties.Resources.Wizard)); } case "btnConvertPDF": { return(new Bitmap(Properties.Resources.pdf)); } case "btnConvertPDFHome": { return(new Bitmap(Properties.Resources.pdf)); } case "btnUpdateFields": { return(new Bitmap(Properties.Resources.calculator)); } case "btnUpdateFieldsHome": { return(new Bitmap(Properties.Resources.calculator)); } case "btnAbout": { return(new Bitmap(Properties.Resources.About)); } case "btnAboutHome": { return(new Bitmap(Properties.Resources.About)); } } return(null); }
public void btnHelp_Click(Microsoft.Office.Core.IRibbonControl control) { ShowHelp(); }