예제 #1
0
        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);
            }
        }
예제 #2
0
        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);
        }
예제 #3
0
        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();
        }
예제 #4
0
        public void btnTableConfigure_Click(Microsoft.Office.Core.IRibbonControl control)
        {
            FormTableOption formTableOption = new FormTableOption();

            formTableOption.ShowDialog();
            ribbon.Invalidate();
        }
예제 #5
0
        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);
            }
        }
예제 #6
0
        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));
        }
예제 #7
0
        /// <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);
        }
예제 #8
0
        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();
        }
예제 #9
0
        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();
        }
예제 #10
0
        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();
        }
예제 #11
0
        public bool GetEnabled(Microsoft.Office.Core.IRibbonControl control)
        {
            bool bRetour = true;

            switch (control.Id)
            {
            case "btnNew":
            {
                bRetour = true;
                break;
            }

            default:
                break;
            }
            return(bRetour);
        }
예제 #12
0
        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);
        }
예제 #13
0
 public void btnConvertPDF_Click(Microsoft.Office.Core.IRibbonControl control)
 {
     Process.Start(@"C:\Program Files\Free PDF Solutions\FreePDFSolutions_PDF2Word.exe");
 }
예제 #14
0
 public void btnWizard_Click(Microsoft.Office.Core.IRibbonControl control)
 {
     Globals.ThisAddIn.Application.ActiveDocument.LoadWizard(Enums.FormLoadType.RibbonClick);
 }
예제 #15
0
        //ここにコールバック メソッドを作成します。コールバック メソッドの追加の詳細については、ソリューション エクスプローラーでリボンの XML アイテムを選択し、F1 キーを押してください
        public void btnConfigure_Click(Microsoft.Office.Core.IRibbonControl control)
        {
            FormOption formOption = new FormOption();

            formOption.ShowDialog();
        }
예제 #16
0
        public void btnUpdateFields_Click(Microsoft.Office.Core.IRibbonControl control)
        {
            Globals.ThisAddIn.Application.ActiveDocument.Fields.Update();

            CalculatePremSummaryTable();
        }
예제 #17
0
        public void btnAbout_Click(Microsoft.Office.Core.IRibbonControl control)
        {
            var about = new About();

            about.ShowDialog();
        }
예제 #18
0
        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);
        }
예제 #19
0
 public void btnHelp_Click(Microsoft.Office.Core.IRibbonControl control)
 {
     ShowHelp();
 }