ms-word

Unable to read all content in order of a word document (docx) in Apache POI

…衆ロ難τιáo~ 提交于 2020-07-02 02:50:26
问题 I've been trying to read all content (including tables, pictures, paragraphs) from a word document. I'm able to read tables and paragraphs using getBodyElementsIterator() but it doesn't read pictures present inside the document. Although I'm able to read pictures seperately using getAllPictures() but I need to read everything in order. I've tried looking for XWPFPicture instance while looping inside getBodyElementsIterator() but I'm not able to find any image instance. Iterator<IBodyElement>

Find and replace text with an image in Word document

左心房为你撑大大i 提交于 2020-06-29 06:22:29
问题 I have figured out how to replace words in documents as this is fairly easy using the find object. Now I am struggling with replacing the word " logo " with an actual logo image throughout a word document. I figured I can loop through each Range in the document and say that if the word logo is found in the range, I can add a picture doing: foreach (Range rngStory in doc.StoryRanges) { rngStory.InlineShapes.AddPicture(filename); } The problem is that this will add the picture to the top of the

Convert word doc to pdf and send as attachment in Outlook

…衆ロ難τιáo~ 提交于 2020-06-28 17:43:37
问题 I would like to convert my Word Doc to a pdf and send it as an attachment as part of my constructed Outlook email. I have tried adding ,".pdf" at the end of my SaveAs2 line, which changed and attached the file format as pdf, however, when attempting to open the file it does not display and gives me a message that the file did not have all it's code when sent as an attachment. Private Sub emailbutton_Click() 'No-option email sending Dim OL As Object Dim EmailItem As Object Dim Doc As Document

Run-time error 4198, command failed, when trying to set ms word doc to print view

醉酒当歌 提交于 2020-06-28 04:45:40
问题 I am trying to set the window view to printView. I've used the "record macro" in word, to see how word suggests I set something to print view. Here's the code: If ActiveWindow.View.SplitSpecial = wdPaneNone Then ActiveWindow.ActivePane.View.Type = wdPrintView Else ActiveWindow.View.Type = wdPrintView End If Each time, the execution stops and gives me the above error. The debug points out: ActiveWindow.View.Type = wdPrintView as the buggy line. I've also tried: If ActiveWindow.View

To replace a text in word document with Hyperlinks, using VBScript

a 夏天 提交于 2020-06-27 18:38:07
问题 I would like to replace a text ,say, 'hello', anywhere in a word document and replace it with Hyperlink - 'http://www.google.com'.I am using a replace function to achieve the same. I understand that the .Range() should be pointing to the text that needs to be replaced. But how. And how will I pass the hyperlink argument to the replace(). Here a sample of the defective code : Set objWord = CreateObject("Word.Application") Set objDoc = objWord.Documents.Open("C:\Test\Test_Hyperlink.docx") Set

Text Box in Outlook Email

别等时光非礼了梦想. 提交于 2020-06-27 15:26:10
问题 Below are two sets of VBA code that deletes text boxes, the first one works in MS Excel and the second in MS Word. The only difference between the two is the third line after "Active". I'm trying to duplicate this action in MS Outlook in a new-opened email but lack the knowledge of the proper code terminology... is there anyone out there that knows the answer to this?... thank you,. Sub RemoveTextBox() Dim shp As Shape For Each shp In ActiveSheet.Shapes If shp.Type = msoTextBox Then shp

MS Word VBA: I need a color palette dialog box

≡放荡痞女 提交于 2020-06-23 03:36:45
问题 In VBA for MS Word 2010, how can I get Word to bring up a color palette dialog box so the user can pick a color? There are tons of examples on how to do it in Excel, but I haven't found any help for Word users. Here's the code for Excel: Application.Dialogs(xlDialogPatterns).Show Problem is, there's no wdDialogPatterns equivalent, nor can I find anything with a name that suggests a color palette dialog. I've found wdFormatBordersAndShading, but it's not quite the same: I want the user to

MS Word VBA: I need a color palette dialog box

时间秒杀一切 提交于 2020-06-23 03:36:08
问题 In VBA for MS Word 2010, how can I get Word to bring up a color palette dialog box so the user can pick a color? There are tons of examples on how to do it in Excel, but I haven't found any help for Word users. Here's the code for Excel: Application.Dialogs(xlDialogPatterns).Show Problem is, there's no wdDialogPatterns equivalent, nor can I find anything with a name that suggests a color palette dialog. I've found wdFormatBordersAndShading, but it's not quite the same: I want the user to

Word through Excel - How to select a portion of text?

て烟熏妆下的殇ゞ 提交于 2020-06-13 06:17:09
问题 I'm working on an Excel-Word VBA code that runs through several Word files and extracts data for the Excel table (where the VBA code takes place). In each of the Word files there will be a "tool" description followed by a reference for this tool (9 char plus a version char) like this : This can be inline with the text, in two paragraphs like for the "tool 1", or in a table cell like the "Tool 2".... An image is included next/after the reference. Of course, there can be more than one Tool...

Word through Excel - How to select a portion of text?

一个人想着一个人 提交于 2020-06-13 06:16:31
问题 I'm working on an Excel-Word VBA code that runs through several Word files and extracts data for the Excel table (where the VBA code takes place). In each of the Word files there will be a "tool" description followed by a reference for this tool (9 char plus a version char) like this : This can be inline with the text, in two paragraphs like for the "tool 1", or in a table cell like the "Tool 2".... An image is included next/after the reference. Of course, there can be more than one Tool...