Ejemplo n.º 1
0
        private void button7_Click(object sender, EventArgs e)
        {
            Microsoft.Office.Interop.Word.Application word = new Microsoft.Office.Interop.Word.Application();
            object miss     = System.Reflection.Missing.Value;
            object path     = Application.StartupPath + "\\1.docx";
            object readOnly = true;

            Microsoft.Office.Interop.Word.Document docs = word.Documents.Open(ref path, ref miss, ref readOnly, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss);
            string totaltext = "";

            for (int i = 0; i < docs.Paragraphs.Count; i++)
            {
                totaltext += " \r\n " + docs.Paragraphs[i + 1].Range.Text.ToString();
            }
            MessageBox.Show(totaltext);
            docs.Close();
            word.Quit();


            label1.Text = "";
            openFileDialog1.InitialDirectory = Application.StartupPath;
            openFileDialog1.FileName         = null;
            openFileDialog1.Filter           = "Файлы txt(*.txt)|*.txt|Файлы doc(*.doc)|*.doc*|Файлы fb2(*.fb2)|*.fb2|Файлы epub(*.epub)|*.epub";
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                OpenBook = openFileDialog1.FileName;
                Process process = new Process();
                process.StartInfo.FileName  = @OpenBook;
                process.StartInfo.Arguments = "";
                process.Start();
            }
        }
        /// <summary>
        /// The constructor
        /// </summary>
        public WordFindKeyAndReplacePopForm()
        {
            InitializeComponent();

            //if we have a document open begin to build the fuctionality or else close the window
            if (Globals.ThisAddIn.Application.Documents.Count > 0)
            {
                //Grab the word app as per the microsoft guide may be useful later
                NativeDocument = Globals.ThisAddIn.Application.ActiveDocument;
                //use that handle to to create the Document
                VSTODocument = Globals.Factory.GetVstoObject(NativeDocument);
                //register a close event to close this code if the program is closed.
                VSTODocument.BeforeClose += CloseEvent;
                //register the event for text being changed
                DocTextChanged += OnDocTextChanged;
                //start the timer loop for text changes
                Ti_Listener.Enabled = true;
                //do a scan pass for the keys for varables
                BuildKeyList();
            }
            else
            {
                Close();
            }
        }
Ejemplo n.º 3
0
        public void IUO(Office.IRibbonControl control)
        {
            Microsoft.Office.Interop.Word.Document nativeDocument = Globals.ThisAddIn.Application.ActiveDocument;
            Microsoft.Office.Tools.Word.Document   vstoDocument   = Globals.Factory.GetVstoObject(nativeDocument);
            Office.DocumentProperties properties = (Office.DocumentProperties)vstoDocument.CustomDocumentProperties;

            if (ReadDocumentProperty("Classification") != null)
            {
                properties["Classification"].Delete();
            }

            properties.Add("Classification", false,
                           Microsoft.Office.Core.MsoDocProperties.msoPropertyTypeString,
                           "Internal");

            foreach (Word.Section wordSection in Globals.ThisAddIn.Application.ActiveDocument.Sections)
            {
                Word.Range footerRange = wordSection.Footers[Word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range;
                footerRange.Font.ColorIndex           = Word.WdColorIndex.wdDarkBlue;
                footerRange.Font.Size                 = 15;
                footerRange.Text                      = "Classification: Internal Use Only";
                footerRange.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter;

                Word.Range headerRange = wordSection.Headers[Word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range;
                headerRange.Font.ColorIndex           = Word.WdColorIndex.wdDarkBlue;
                headerRange.Font.Size                 = 15;
                headerRange.Text                      = "Classification: Internal Use Only";
                headerRange.ParagraphFormat.Alignment = Word.WdParagraphAlignment.wdAlignParagraphCenter;
            }
        }
Ejemplo n.º 4
0
        //---------------------------------------------------------------------
        void Test1()
        {
            //<Snippet3>
            Word.Document doc;
            //</Snippet3>

            doc = new Microsoft.Office.Interop.Word.Document();
        }
Ejemplo n.º 5
0
 void WordApplicationDocumentBeforeClose(Microsoft.Office.Interop.Word.Document doc, ref bool cancel)
 {
     if (TestDocu.ContainsKey(doc))
     {
         TestDocu.Remove(doc);
     }
     // OpenDocuments.Remove(doc);
     // Console.WriteLine(doc.Name + " closed!");
 }
Ejemplo n.º 6
0
 void Application_DocumentBeforeClose(Microsoft.Office.Interop.Word.Document Doc, ref bool Cancel)
 {
     // If just about to close the last doc/window, keep the pane open at home
     if (Application.Windows.Count == 1)
     {
         myUserControl1.showHome(Application);
         bNoDocuments = true;
     }
 }
Ejemplo n.º 7
0
 private void Application_WindowActivate(Microsoft.Office.Interop.Word.Document Doc, Microsoft.Office.Interop.Word.Window Wn)
 {
     try
     {
         CreateCiNiuTaskPane();
     }
     catch (Exception ex)
     { }
 }
Ejemplo n.º 8
0
        void Application_DocumentBeforeClose(Microsoft.Office.Interop.Word.Document doc, ref bool cancel)
        {
            this.Application.StatusBar = statusMessage;
            string docFullName = doc.FullName;

            if (EditedPages.ContainsKey(docFullName))
            {
                doc.Saved = true;
                EditedPages.Remove(doc.FullName);
            }
        }
Ejemplo n.º 9
0
 private void CreateDocumentHostItem()
 {
     //<Snippet8>
     if (Globals.ThisAddIn.Application.Documents.Count > 0)
     {
         Microsoft.Office.Interop.Word.Document nativeDocument =
             Globals.ThisAddIn.Application.ActiveDocument;
         Microsoft.Office.Tools.Word.Document vstoDocument =
             Globals.Factory.GetVstoObject(nativeDocument);
     }
     //</Snippet8>
 }
Ejemplo n.º 10
0
 private void WorkWithDocument(Microsoft.Office.Interop.Word.Document Doc)
 {
     try
     {
         Word.Range rng = Doc.Range(0, 0);
         rng.Text = "New Text";
         rng.Select();
     }
     catch (Exception ex)
     {
         // Handle exception if for some reason the document is not available.
     }
 }
Ejemplo n.º 11
0
        void Application_DocumentOpen(Microsoft.Office.Interop.Word.Document Doc)
        {
            String strAlfPath = null;
            int    nPosition;

            nPosition = Doc.FullName.IndexOf(strAlfServer);
            if (nPosition == 0)
            {
                AddAlfrescoTaskPane(Doc);
                strAlfPath = Doc.FullName.Substring(strAlfServer.Length + 1);
                myUserControl1.showDocumentDetails(strAlfPath);
                bNoDocuments = false;
            }
        }
Ejemplo n.º 12
0
 private Microsoft.Office.Interop.Word.Table GiveMeATable(
     int columnCount, int rowCount, Microsoft.Office.Interop.Word.Document doc, Microsoft.Office.Interop.Word.Range rg)
 {
     if (columnCount > 0 & rowCount > 0)
     {
         //We aren't goofing around. Let's make a table.
         Microsoft.Office.Interop.Word.Table tbl = default(Microsoft.Office.Interop.Word.Table);
         tbl = doc.Tables.Add(rg, rowCount, columnCount,
                              Microsoft.Office.Interop.Word.WdDefaultTableBehavior.wdWord9TableBehavior,
                              Microsoft.Office.Interop.Word.WdAutoFitBehavior.wdAutoFitContent);
         return(tbl);
     }
     return(null);
 }
Ejemplo n.º 13
0
 void WordApplicationDocumentOpen(Microsoft.Office.Interop.Word.Document doc)
 {
     // If this returns true, the doc is not in the set of open documents, hence the doc is not already open
     if (OpenDocuments.Add(doc))
     {
         OpenDocuments.Add(doc);
         Template.GetInstance().DisplayBJLetter();
     }
     // Otherwise, the doc is already in the set of open documents, hence we know the document is already open
     else
     {
         //Console.WriteLine(doc.Name + " is already open!");
         Template.GetInstance().DisplayBJLetter();
     }
 }
Ejemplo n.º 14
0
        public string ReadDocumentProperty(string propertyName)
        {
            Microsoft.Office.Interop.Word.Document nativeDocument = Globals.ThisAddIn.Application.ActiveDocument;
            Microsoft.Office.Tools.Word.Document   vstoDocument   = Globals.Factory.GetVstoObject(nativeDocument);
            Office.DocumentProperties properties = (Office.DocumentProperties)vstoDocument.CustomDocumentProperties;

            foreach (Office.DocumentProperty prop in properties)
            {
                if (prop.Name == propertyName)
                {
                    return(prop.Value.ToString());
                }
            }
            return(null);
        }
Ejemplo n.º 15
0
        private void Application_DocumentOpen2(Microsoft.Office.Interop.Word.Document Doc)
        {
            //<Snippet5>
            if (this.Application.ActiveDocument.Bookmarks.Count > 0)
            {
                object        index         = 1;
                Word.Bookmark firstBookmark = this.Application.ActiveDocument.Bookmarks.get_Item(ref index);


                Document extendedDocument = Globals.Factory.GetVstoObject(this.Application.ActiveDocument);

                Bookmark vstoBookmark = extendedDocument.Controls.AddBookmark(
                    firstBookmark, "VSTOBookmark");
            }
            //</Snippet5>
        }
Ejemplo n.º 16
0
        /// <summary>
        /// Event triggered before closing a document.
        /// </summary>
        /// <param name="doc">The instance of the document.</param>
        /// <param name="cancel">Reference to a variable stating if the operation should be canceled.
        /// Switch the value to 'true' to cancle the closing.
        /// </param>
        void Application_DocumentBeforeClose(Microsoft.Office.Interop.Word.Document doc, ref bool cancel)
        {
            string docFullName = doc.FullName;

            //if is edited wiki page
            if (EditedPages.ContainsKey(docFullName))
            {
                //Prevent default save dialog from appearing.
                doc.Saved = true;
                //TODO: display a custom dialog for saving to the wiki.
            }
            RemoveTaskPane(doc);
            if (EditedPages.ContainsKey(doc.FullName))
            {
                EditedPages.Remove(doc.FullName);
            }
        }
Ejemplo n.º 17
0
 private void ApplicationDocumentBeforeClose(Microsoft.Office.Interop.Word.Document document, ref bool cancel)
 {
     if (document.Application.Documents.Count == 1)
     {
         // Es el último
         if (MenuListener != null)
         {
             OfficeApplication.MenuListener.NoDocumentsActive();
         }
     }
     else
     {
         if (MenuListener != null)
         {
             OfficeApplication.MenuListener.DocumentsActive();
         }
     }
 }
Ejemplo n.º 18
0
 public void AddAlfrescoTaskPane(Microsoft.Office.Interop.Word.Document Doc)
 {
     if (bNoDocuments == false)
     {
         myUserControl1 = new UserControl1();
         if (Doc != null)
         {
             myCustomTaskPane = this.CustomTaskPanes.Add(myUserControl1, "Alfresco Task Pane");
         }
         else
         {
             myCustomTaskPane = this.CustomTaskPanes.Add(myUserControl1, "Alfresco Task Pane");
         }
         myCustomTaskPane.Width   = 300;
         myCustomTaskPane.Visible = true;
         myUserControl1.AlfServer = strAlfServer;
     }
 }
Ejemplo n.º 19
0
        void Application_WindowActivate(Microsoft.Office.Interop.Word.Document Doc, Microsoft.Office.Interop.Word.Window Wn)
        {
            try
            {
                // Template.GetInstance().DisplayBJLetter();
                Word.Document docCurr = this.Application.ActiveDocument;
                if (!String.IsNullOrWhiteSpace(docCurr.Path))
                {
                    //Template.GetInstance().DisplayBJLetter();
                    if (!TestDocu.ContainsKey(Doc))
                    {
                        TestDocu.Add(Doc, true);
                        Template.GetInstance().DisplayBJLetter();
                    }
                    // Otherwise, the doc is already in the set of open documents, hence we know the document is already open
                    else
                    {
                        if (TestDocu[Doc] == false)
                        {
                            //Console.WriteLine(doc.Name + " is already open!");
                            Template.GetInstance().DisplayBJLetter();
                        }
                    }
                }
                //if (initialized == false)
                //{
                //    Word.Document doc = this.Application.ActiveDocument;
                //    if (String.IsNullOrWhiteSpace(doc.Path))
                //    {

                //    }
                //    else
                //    {
                //        initialized = true;
                //        Template.GetInstance().DisplayBJLetter();
                //    }
                //}
            }
            catch (Exception ex)
            {
                Logger.LogWriter(ex.StackTrace);
            }
        }
Ejemplo n.º 20
0
        public void WorkWithDocument(Microsoft.Office.Interop.Word.Document Doc)
        {
            searchTerms = new string[] { "P0", "P1", "Priority Rating", "ImageDate", "Equipment", "Location" };

            foreach (string i in searchTerms)
            {
                buildDictionary(i);
            }

            replaceTerms = new string[] { "P1Temperature", "P2Temperature", "DT1", "Photo 1." };

            foreach (string i in replaceTerms)
            {
                buildDoc(i);
            }
            buildTable();
            deleteMarkerTable();
            fixFooter();
        }
Ejemplo n.º 21
0
        public void RemoveClassificationButton(Office.IRibbonControl control)
        {
            Microsoft.Office.Interop.Word.Document nativeDocument = Globals.ThisAddIn.Application.ActiveDocument;
            Microsoft.Office.Tools.Word.Document   vstoDocument   = Globals.Factory.GetVstoObject(nativeDocument);
            Office.DocumentProperties properties = (Office.DocumentProperties)vstoDocument.CustomDocumentProperties;

            if (ReadDocumentProperty("Classification") != null)
            {
                properties["Classification"].Delete();
            }

            foreach (Word.Section wordSection in Globals.ThisAddIn.Application.ActiveDocument.Sections)
            {
                Word.Range footerRange = wordSection.Footers[Word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range;
                footerRange.Delete();
                Word.Range headerRange = wordSection.Headers[Word.WdHeaderFooterIndex.wdHeaderFooterPrimary].Range;
                headerRange.Delete();
            }
        }
Ejemplo n.º 22
0
 void Application_DocumentOpen(Microsoft.Office.Interop.Word.Document Doc)
 {
     try
     {
         Word.Document doc = this.Application.ActiveDocument;
         if (String.IsNullOrWhiteSpace(doc.Path))
         {
         }
         else
         {
             //initialized = true;
             Template.GetInstance().DisplayBJLetter();
         }
     }
     catch (Exception ex)
     {
         Logger.LogWriter(ex.StackTrace);
     }
 }
Ejemplo n.º 23
0
        private void ActivateDocument(Microsoft.Office.Interop.Word.Document document)
        {
            OfficeDocument officeDocument = new Word2007OfficeDocument(document);

            if (officeDocument.IsPublished)
            {
                if (MenuListener != null)
                {
                    OfficeApplication.MenuListener.DocumentPublished();
                }
            }
            else
            {
                if (MenuListener != null)
                {
                    OfficeApplication.MenuListener.NoDocumentPublished();
                }
            }
        }
Ejemplo n.º 24
0
        ///<summary>
        /// Executes a process and waits for it to end.
        ///</summary>
        ///<param name="cmd">Full Path of process to execute.</param>
        ///<param name="cmdParams">Command Line params of process</param>
        ///<param name="workingDirectory">Process' working directory</param>
        ///<param name="timeout">Time to wait for process to end</param>
        ///<param name="stdOutput">Redirected standard output of process</param>
        ///<returns>Process exit code</returns>
        private void ExecuteProcess(object infoObject)
        {
            if (info.process != null && !info.process.HasExited)
            {
                Debug.WriteLine("ExecuteProcess exiting; previous process " + info.process.Id + " for job " + hdata.job + " still running.");
                return; // there's another TurKit already running; exit and wait for it to finish
            }
            Debug.WriteLine("Running process for job " + this.hdata.job);

            // TODO: Clearing the error console each time the program runs is a bit of a hack,
            // but it's the best time/benefit tradeoff to avoid having error messages
            // stick around forever
            Microsoft.Office.Interop.Word.Document doc = Globals.Soylent.jobToDoc[hdata.job];
            Globals.Soylent.soylentMap[doc].Invoke(new HITData.clearErrorDelegate(hdata.clearErrors), new object[] { });

            ProcessInformation execute_info = (ProcessInformation)infoObject;

            if (execute_info.showWindow)
            {
                execute_info.cmdParams = " /k " + execute_info.cmd + execute_info.cmdParams;
                execute_info.cmd       = "cmd";
            }

            execute_info.process           = new Process();
            execute_info.process.StartInfo = new ProcessStartInfo(execute_info.cmd, execute_info.cmdParams);
            execute_info.process.StartInfo.WorkingDirectory = execute_info.workingDirectory;
            execute_info.process.StartInfo.UseShellExecute  = false;
            if (!execute_info.showWindow)
            {
                execute_info.process.StartInfo.CreateNoWindow = true;
                execute_info.process.StartInfo.WindowStyle    = ProcessWindowStyle.Hidden;
                // NOTICE: if you redirect stdout or stderr, you will need to consume it
                // using StandardOutput.ReadToEnd() each time you wake up or the process will never exit.
                // E.g., ExecuteProcess reads, then sleeps for 2 seconds so the processes die, then it can move on.
                // Recommendation: If you need the output, show the window instead.
                execute_info.process.StartInfo.RedirectStandardOutput = false;
                execute_info.process.StartInfo.RedirectStandardError  = false;
            }
            execute_info.process.Start();
            info.process = execute_info.process;

            execute_info.process.WaitForExit();
        }
Ejemplo n.º 25
0
        private void WorkWithDocument(Microsoft.Office.Interop.Word.Document Doc)
        {
            try
            {
                Word.Range rng = Doc.Range(0, 0);

                rng.Text = "Hello World";

                this.PageSetting(Doc, this.Application);
                this.CreateIndex(Doc, this.Application);


                //rng.Select();
            }
            catch (Exception ex)
            {
                // Handle exception if for some reason the document is not available.
            }
        }
Ejemplo n.º 26
0
        private void WorkWithDocument(Microsoft.Office.Interop.Word.Document Doc)
        {
            // A method to add text in range
            //Specify a range at the beginning of a document and insert the text New Text
            // Word.Range rng = this.Application.ActiveDocument.Range(0, 0);
            // rng.Text = "New Text";

            //Select the Range object, which has expanded from one character to the length of the inserted text.
            //rng.Select();

            // To replace text in a range
            //Word.Range rng = this.Application.ActiveDocument.Range(0, 12);

            //Replace those characters with the string New Text.
            //rng.Text = "New Text";

            // Select the range
            // rng.Select();



            // Initializing the Range object
            Word.Range PacktRangeSelect;
            // Check the sentence count
            if (this.Sentences.Count >= 1)
            {
                // Set the start and ent point has object
                object pktStartFrom = this.Sentences[2].Start;
                object pktStopHere  = this.Sentences[5].End;
                // Assign the selection range
                PacktRangeSelect = this.Range(ref pktStartFrom, ref pktStopHere);
                // Select the sentence using Select() method
                PacktRangeSelect.Select();
            }
            else
            {
                return;
            }
        }
        void Application_DocumentBeforeSave(Word.Document Doc, ref bool SaveAsUI, ref bool Cancel)
        {
            Microsoft.Office.Interop.Word.Document   nativeDocument = Globals.ThisAddIn.Application.ActiveDocument;
            Microsoft.Office.Tools.Word.Document     vstoDocument   = Globals.Factory.GetVstoObject(nativeDocument);
            Microsoft.Office.Core.DocumentProperties properties     = (Office.DocumentProperties)vstoDocument.CustomDocumentProperties;
            string messageBoxText = "We noticed you haven't classified your document, would you like to opt out of classifying this document?";
            string caption        = "Classify Your Document";

            object oBasic = Application.WordBasic;

            object fIsAutoSave =
                oBasic.GetType().InvokeMember(
                    "IsAutosaveEvent",
                    BindingFlags.GetProperty,
                    null, oBasic, null);

            MessageBoxButtons button = MessageBoxButtons.YesNo;
            MessageBoxIcon    icon   = MessageBoxIcon.Warning;

            if (ReadDocumentProperty2("Classification") == null && !(int.Parse(fIsAutoSave.ToString()) == 1))
            {
                DialogResult result = MessageBox.Show(messageBoxText, caption, button, icon);
                switch (result)
                {
                case DialogResult.Yes:
                    properties.Add("Classification", false,
                                   Microsoft.Office.Core.MsoDocProperties.msoPropertyTypeString,
                                   "Not Classified");
                    break;

                case DialogResult.No:
                    MessageBox.Show("Please add a classification and try saving the document again", "Classify", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Cancel = true;
                    break;
                }
            }
        }
Ejemplo n.º 28
0
        private void Application_DocumentOpen(Microsoft.Office.Interop.Word.Document Doc)
        {
            if (Doc.ContentControls.Count > 0)
            {
                Document extendedDocument = Globals.Factory.GetVstoObject(Doc);

                richTextControls = new System.Collections.Generic.List
                                   <Microsoft.Office.Tools.Word.RichTextContentControl>();
                int count = 0;

                foreach (Word.ContentControl nativeControl in Doc.ContentControls)
                {
                    if (nativeControl.Type ==
                        Microsoft.Office.Interop.Word.WdContentControlType.wdContentControlRichText)
                    {
                        count++;
                        Microsoft.Office.Tools.Word.RichTextContentControl tempControl =
                            extendedDocument.Controls.AddRichTextContentControl(nativeControl,
                                                                                "VSTORichTextControl" + count.ToString());
                        richTextControls.Add(tempControl);
                    }
                }
            }
        }
Ejemplo n.º 29
0
        /// <summary>
        /// Create OpenDoPE parts, including optionally, question part.
        /// </summary>
        public void process()
        {
            Microsoft.Office.Interop.Word.Document document = null;
            try
            {
                document = Globals.ThisAddIn.Application.ActiveDocument;
            }
            catch (Exception ex)
            {
                Mbox.ShowSimpleMsgBoxError("No document is open/active. Create or open a docx first.");
                return;
            }

            Model model = Model.ModelFactory(document);

            // Button shouldn't be available if this exists,
            // but ..
            if (model.conditionsPart == null)
            {
                conditions conditions    = new conditions();
                string     conditionsXml = conditions.Serialize();
                model.conditionsPart = addCustomXmlPart(document, conditionsXml);
            }

            if (model.componentsPart == null)
            {
                components components    = new components();
                string     componentsXml = components.Serialize();
                model.componentsPart = addCustomXmlPart(document, componentsXml);
            }

            // Add XPath
            xpaths xpaths = new xpaths();

            // Button shouldn't be available if this exists,
            // but ..
            if (model.xpathsPart != null)
            {
                xpaths.Deserialize(model.xpathsPart.XML, out xpaths);
            }
            int idInt = 1;

            foreach (Word.ContentControl cc in Globals.ThisAddIn.Application.ActiveDocument.ContentControls)
            {
                if (cc.XMLMapping.IsMapped)
                {
                    log.Debug("Adding xpath for " + cc.ID);
                    // then we need to add an XPath
                    string xmXpath = cc.XMLMapping.XPath;

                    xpathsXpath item = new xpathsXpath();
                    // I make no effort here to check whether the xpath
                    // already exists, since the part shouldn't already exist!

                    item.id = "x" + idInt;


                    xpathsXpathDataBinding db = new xpathsXpathDataBinding();
                    db.xpath       = xmXpath;
                    db.storeItemID = cc.XMLMapping.CustomXMLPart.Id;
                    if (!string.IsNullOrWhiteSpace(cc.XMLMapping.PrefixMappings))
                    {
                        db.prefixMappings = cc.XMLMapping.PrefixMappings;
                    }
                    item.dataBinding = db;

                    xpaths.xpath.Add(item);

                    // Write tag
                    TagData td = new TagData(cc.Tag);
                    td.set("od:xpath", item.id);
                    cc.Tag = td.asQueryString();

                    log.Debug(".. added for " + cc.ID);
                    idInt++;
                }
            }
            string xpathsXml = xpaths.Serialize();

            if (model.xpathsPart == null)
            {
                model.xpathsPart = addCustomXmlPart(document, xpathsXml);
            }
            else
            {
                CustomXmlUtilities.replaceXmlDoc(model.xpathsPart, xpathsXml);
            }


            Microsoft.Office.Tools.Word.Document extendedDocument
                = Globals.ThisAddIn.Application.ActiveDocument.GetVstoObject(Globals.Factory);

            //Microsoft.Office.Tools.CustomTaskPane ctp
            //    = Globals.ThisAddIn.createCTP(document, cxp, xpathsPart, conditionsPart, questionsPart, componentsPart);
            //extendedDocument.Tag = ctp;
            //// Want a 2 way association
            //WedTaskPane wedTaskPane = (WedTaskPane)ctp.Control;
            //wedTaskPane.associatedDocument = document;

            //extendedDocument.Shutdown += new EventHandler(
            //    Globals.ThisAddIn.extendedDocument_Shutdown);

            //taskPane.setupCcEvents(document);

            log.Debug("Done. Task pane now also open.");
        }
Ejemplo n.º 30
0
 /// <summary>
 /// Event triggered when a document is openend.
 /// </summary>
 /// <param name="Doc">The instance of the document.</param>
 void Application_DocumentOpen(Microsoft.Office.Interop.Word.Document Doc)
 {
     AddTaskPane(Doc);
 }