ms-word

How can I grab each page of text in a Word doc separately (using .NET)?

ぃ、小莉子 提交于 2020-01-05 05:05:45
问题 I need to determine which pages of a Word document that a keyword occurs on. I have some tools that can get me the text of the document, but nothing that tells me which pages the text occurs on. Does anyone have a good starting place for me? I'm using .NET Thanks! edit: Additional constraint: I can't use any of the Interop stuff. edit2: If anybody knows of stable libraries that can do this, that'd also be helpful. I use Aspose, but as far as I know that doesn't have anything. 回答1: This is how

Problem with processing word document java

安稳与你 提交于 2020-01-05 04:57:19
问题 i need to replace some fields in Word Document file in java.I am using Apache Poi library , i am using this code to replace words. for (XWPFParagraph p : doc.getParagraphs()) { List<XWPFRun> runs = p.getRuns(); if (runs != null) { for (XWPFRun r : runs) { String text = r.getText(0); if (text != null) { System.out.println(text); if (text.contains("[Title]")) { text = text.replace("[Title]", wordBody.getTitle());//your content r.setText(text, 0); }if(text.contains("[Ref_no]")){ text=text

Possible to Insert page in word document with python-docx?

别等时光非礼了梦想. 提交于 2020-01-05 04:51:26
问题 I just read through the documentation on python-docx. They mention several times that added content is created at the end of the document, but I didn't notice any way to alter this functionality. Does anyone know how to add a new page to a pre-existing document, but make it page 1? Thanks! 回答1: The short answer is the library doesn't support that just yet, although those features are high on the backlog so will be among the next to be implemented. To get it done in the meantime you'll need to

Manipulating Microsoft Word document without using Interop

雨燕双飞 提交于 2020-01-05 04:36:15
问题 Is there any alternatives to manipulate Microsoft Word document (2003 and above) without using Microsoft.Office.Interop assemblies ? Is it possible to manipulate Microsoft Word document using native .NET assemblies without using COM ? Is there any third party components that provide native manipulation of the Microsoft Word document ? 回答1: Aspose DocID OfficeWriter Windward reports TXText The OpenXML sdk (for the new XML office file formats anyway) All decent tools, they each have pluses and

Keyboard hook fires multiple times in MS Word

让人想犯罪 __ 提交于 2020-01-05 04:28:16
问题 This is in reference to a question asked in Detecting text changes in Word 2016 from VSTO add-in While the answer provided by Dirk Vollmar works, I noticed that hitting one key triggers KeyboardHookCallBack 10-12 times and I am not able to capture accurately the sequence the keys are being hit in. Pardon me if my question is stupid but is there a way to make sure that the KeyboardHookCallBack is triggered only once for each key? I have been trying this for some time now without any luck. I'd

Iterate through pages in Word and find pages contains image

人走茶凉 提交于 2020-01-05 04:16:10
问题 I want to iterate though every page in a word document, check if that page contains an images or not, and do something about that page (Set page margin and insert a break). For Each Page in Document.Pages If Page.ContainsImage Then Page.TopMargin = 0 DoOtherStuff End If Next 回答1: A Document has a Shapes Collection representing all the Shapes. Each Shape has an Anchor , using which we can get to the TopMargin , and other properties, of the shape's page: Sub JiggleAllShapes() Dim shp As Shape

VB Macro to copy word comments from one doc to another

佐手、 提交于 2020-01-05 03:37:11
问题 I'm trying to copy some comments from a .docx file to another, together with all the replies made to those comments. I've remove non essential parts to not confuse you. Dim sourceDoc As Word.Document Dim targetDoc As Word.Document Set sourceDoc = GetObject("E:\tests\src.docx") Set targetDoc = GetObject("E:\tests\dest.docx") For Each comment In sourceDoc.Comments text = comment.Scope.text comment.Scope.Select Set range = targetDoc.range(comment.Scope.Start, comment.Scope.End) range.Expand

Extract embedded Excel worksheet data from Word

梦想的初衷 提交于 2020-01-04 06:07:53
问题 I have a batch of Word documents that have embedded Excel worksheets. Users have been entering data in the Excel sheet by double clicking the image of the sheet and opening an embedded Excel object. I need to get to the user entered data. Below is WORD VBA with a reference to the Microsoft Excel 15 library. (The Word and Excel object where created under Office 2010.) I can find the OLE object but I can't do anything with it. In the code below I tried to assign the object to a Worksheet object

Open XML Table Header Same page

江枫思渺然 提交于 2020-01-04 05:56:34
问题 I am making an OpenXML document generator. It generates Word Documents based on system data. I Have table headers set up and they work a treat. My issue is as follows: In particular circumstances (if the header fits on the page, but the next row doesn't) it will show the header, then there will be the page break and it will show again on the new page. This is of course expected behavior, and is fixed by manually going into the generated document and adding a new line or two before the table,

Open XML Table Header Same page

有些话、适合烂在心里 提交于 2020-01-04 05:56:25
问题 I am making an OpenXML document generator. It generates Word Documents based on system data. I Have table headers set up and they work a treat. My issue is as follows: In particular circumstances (if the header fits on the page, but the next row doesn't) it will show the header, then there will be the page break and it will show again on the new page. This is of course expected behavior, and is fixed by manually going into the generated document and adding a new line or two before the table,