Пример #1
0
        /// <summary>
        /// Occurs immediately before any open document closes. (Inherited from ApplicationEvents4_Event.)
        /// </summary>
        /// <param name="Doc"></param>
        /// <param name="Cancel"></param>
        private void Application_DocumentBeforeClose(Word.Document Doc, ref bool Cancel)
        {
            // get template information
            TemplateInfo templateInfo = Wkl.MainCtrl.CommonCtrl.GetTemplateInfo(Doc.FullName);

            if (templateInfo == null)
            {
                return;
            }

            // remove internal bookmark, makrup object and datasegment
            if (!templateInfo.IsReConstructing)
            {
                Wkl.MainCtrl.CommonCtrl.RemoveTemplateInfo(Doc.FullName);
            }

            // check pde content
            ContextManager contextMgr = new ContextManager();

            contextMgr.CheckPdeContent(Doc, templateInfo.PdeContent);
            if (templateInfo.PdeContent != null && templateInfo.PdeContent.Items != null &&
                templateInfo.PdeContent.Items.Exists(c => c.Status == Constants.ContextManager.NotUsingStatus))
            {
                DialogResult result = MessageBox.Show("Has some pde template are not used. Do you want to check and process?",
                                                      "Confirm", MessageBoxButtons.YesNo);
                if (result == DialogResult.Yes)
                {
                    ImportPdeControl importer = new ImportPdeControl(Doc, templateInfo.PdeContent, false);
                    importer.ShowDialog();
                    templateInfo.PdeContent = importer.PdeContent;
                }
            }

            contextMgr.CloseExcel();
        }
Пример #2
0
        public void btnPdeIntergrateImport_Click(Office.IRibbonControl control)
        {
            TemplateInfo     templateInfo = Wkl.MainCtrl.CommonCtrl.CommonProfile.CurrentTemplateInfo;
            ImportPdeControl importer     = new ImportPdeControl(Wkl.MainCtrl.CommonCtrl.CommonProfile.ActiveDoc,
                                                                 templateInfo.PdeContent, true);

            importer.ShowDialog();

            templateInfo.PdeContent  = importer.PdeContent;
            templateInfo.IsProntoDoc = true;
        }