ms-word

select a range of text from one Word document and copy into another Word document

旧时模样 提交于 2020-01-01 09:40:18
问题 I'm trying to use VBA to extract sentences in one Word document and put it into another Word document. So for example, if we need to find the title of the organization, we follow the algorithm: Search for "Title" Do (Take) each character after "Title" and (stop) until "Address" 回答1: The following works but there may be a more efficient way of doing this: Sub FindIt() Dim blnFound As Boolean Dim rng1 As Range Dim rng2 As Range Dim rngFound As Range Dim strTheText As String Application

Extract text from pdf and word files

假如想象 提交于 2020-01-01 09:16:50
问题 How can I extract text from pdf or word files (remove bold, images, and other rich text formatting media) in C#? 回答1: You can use the filters designed for / used by the indexing service. They're designed to extract the plain text out of various documents, which is useful for searching inside a document. You can use it for Office files, PDFs, HTML and so on, basically any file type that has a filter. The only downside is that you have to install these filters on the server, so if you don't

Word insertOoxml method returning Error: Unknown for all input

你说的曾经没有我的故事 提交于 2020-01-01 06:46:10
问题 I have an existing Word Add-In solution that has been working well for a long time that now cannot insert OOXML content into Word documents. Trying to break this down I can't get the insertOoxml method to work under any circumstance. To reproduce: await Word.run(async (context) => { context.document.getSelection().insertOoxml(theOoxml, 'Start'); await context.sync(); }); Where theOoxml can be any valid Ooxml string. The reference example I have been using is: <pkg:package xmlns:pkg="http:/

How can I use Microsoft Word's spelling/grammar checker programmatically?

删除回忆录丶 提交于 2020-01-01 03:21:05
问题 I want to process a medium to large number of text snippets using a spelling/grammar checker to get a rough approximation and ranking of their "quality." Speed is not really of concern either, so I think the easiest way is to write a script that passes off the snippets to Microsoft Word (2007) and runs its spelling and grammar checker on them. Is there a way to do this from a script (specifically, Python)? What is a good resource for learning about controlling Word programmatically? If not, I

OpenXML replace text in all document

*爱你&永不变心* 提交于 2020-01-01 03:01:08
问题 I have the piece of code below. I'd like replace the text "Text1" by "NewText", that's work. But when I place the text "Text1" in a table that's not work anymore for the "Text1" inside the table. I'd like make this replacement in the all document. using (WordprocessingDocument doc = WordprocessingDocument.Open(String.Format("c:\\temp\\filename.docx"), true)) { var body = doc.MainDocumentPart.Document.Body; foreach (var para in body.Elements<Paragraph>()) { foreach (var run in para.Elements

What events can I use to monitor users typing in Word?

99封情书 提交于 2019-12-31 07:09:06
问题 I'm trying to write some code which executes as you type in Word. Which events should I observe to catch individual words or characters? Ideally I'd rather not observe keystrokes through some dll calls. I assumed the Word object model would expose some classes with native VBA events, but the only two event objects: Word.Document Word.Application don't have any events that leap out at me. ( Document_Change event doesn't seem to do what I want) Is there a native way of executing a code when the

How to insert page footer with page numbers, file path and image?

拥有回忆 提交于 2019-12-31 07:06:09
问题 I'm trying to format the footer so it has the page # (x out of y) on the top right of the footer, and then the image centered below. I ended up writing an algorithm for the page # and then used inlineshapes to insert the image above. The problem is the text is below the image and the image is not centered. Any help would be appreciated. .ActiveDocument.Sections(1).Headers(wdHeaderFooterPrimary).range.Paragraphs.Alignment = wdAlignParagraphCenter 'Centers Header' .ActiveDocument.Sections(1)

VBA Macro to search a text string and replace with hyperlink works only with English text, but not Arabic

五迷三道 提交于 2019-12-31 06:44:14
问题 I have Arabic texts in Microsoft Word that I need to introduce hpyerlinks to some of its words. The reply to this question here works for me, but only for English words. When I replace the word "google" with any Arabic string (Whether one word or multiple words), the macro does not work. I can display the Arabic characters correctly in VBA, using the answer to this question here, so there are no problems displaying the text in the macro. Can you please help me understanding what code

VBA Macro to search a text string and replace with hyperlink works only with English text, but not Arabic

ぃ、小莉子 提交于 2019-12-31 06:43:26
问题 I have Arabic texts in Microsoft Word that I need to introduce hpyerlinks to some of its words. The reply to this question here works for me, but only for English words. When I replace the word "google" with any Arabic string (Whether one word or multiple words), the macro does not work. I can display the Arabic characters correctly in VBA, using the answer to this question here, so there are no problems displaying the text in the macro. Can you please help me understanding what code

using word object in windows server

泪湿孤枕 提交于 2019-12-31 05:49:07
问题 I have asp.net app which at some point takes word document, edits some of the data there and sends it to email. While this is running good on my local computer where I have microsoft word, when I am trying to do the same thing from windows server without microsoft word installed, the document doesn't get created, and it seems that nothing is happening. Does anyone can tell me what do I need to install for this to work, do I need to install normal microsoft word application or I can install