DocX
DocX copied to clipboard
Is it possible to get text from currently opened word document ?
Hi, I know that we can get text from currently opened word document with System.Runtime.InteropServices.Marshal.GetActiveObject function. Is it possible to get the same thing in DocX ? All i need to get the text from currently opened word document in MS Word.
Hi, Yes. With DocX, you have access to all the paragraphs of the document. You can parse them to get their text data. But just to make sure, if the document is currently opened with MS Word while you use DocX to open the same document, it won't work, saying the document is already in use by another process.
Thanks for the answer. So you mean, if i opened a document with "Load" method in DocX, i can get the text. I am aware about that. But what i need is to get the text from a document which is already opened without using DocX.
Hi, As explained earlier, if the document is opened with MS Word, and you want to use DocX to open and parse the same document, it won't work, saying the document is already in use by another process.