ms-word

How to extract the contents of an OLE container?

主宰稳场 提交于 2020-01-13 10:43:07
问题 I need to break open a MS Word file (.doc) and extract its constituent files ('[1]CompObj', 'WordDocument' etc). Something like 7-zip can be used to do this manually but I need to do this programatically. I've gathered that a Word document is an OLE container (hence why 7-zip can be used to view its contents) but I can't work out how to (using C++): open the OLE container extract each constituent file and save it to disk I've found a couple of examples of OLE automation (eg here) but what I

Underlining and bolding text

元气小坏坏 提交于 2020-01-13 09:48:25
问题 how do I get the text to be underlined and bold? My text gets bold but does not get underlined. Here is some of my code, which is pretty straight forward uses run properties to bold and underline the given text. Run run_header = para_main.AppendChild(new Run()); RunProperties runProps = new RunProperties(); Bold bold = new Bold(); Underline ul = new Underline(); runProps.Append(bold); runProps.Append(ul); run_header.AppendChild(new RunProperties(runProps)); //run_header.AppendChild(new

Select the content of Word document and paste it into the body of Outlook with VBA

爷,独闯天下 提交于 2020-01-13 06:38:08
问题 I have a Word template created and I need to do the following: Create a new document based on that template Modify some data of the new template and copy all its contents Open Outlook and paste the template into the body of the message Send the message to the corresponding recipient Note: The base template will be used for several recipients according to their data. Basically, it is almost the same function that the Word correspondence tab fulfills, only customized. In addition, the VBA code

Insert HTML or RTF formatted text into Word Bookmark

妖精的绣舞 提交于 2020-01-13 05:56:29
问题 I try to insert formatted text into Word bookmarks. The text comes from several rich text controls (we use TX Text Control) and is appended into a bookmark. The problem is that the tags are written as-is and are not interpreted. oWord = New Word.Application Dim strFileName As String = "\\...\Template.dot" oDoc = oWord.Documents.Add(strFileName) Dim strText As String = "" Dim strOut As String = "" txtPart1.Save(strOut, TXTextControl.StringStreamType.RichTextFormat) strText += strOut strText +=

Print word document using c#

梦想与她 提交于 2020-01-13 05:56:12
问题 I have this code to open a word file int num = 0; object fileName = FD.FileName; object readOnly = false; object isVisible = false; object missing = System.Reflection.Missing.Value; Word.Application WordApp = new Word.Application(); Word.Document aDoc = null; WordApp.Visible = false; aDoc = WordApp.Documents.Open(ref fileName, ref missing, ref readOnly, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref isVisible, ref missing, ref

Formatted output in OpenOffice/Microsoft Word with Python

让人想犯罪 __ 提交于 2020-01-12 19:29:41
问题 I am working on a project (in Python) that needs formatted, editable output. Since the end-user isn't going to be technically proficient, the output needs to be in a word processor editable format. The formatting is complex (bullet points, paragraphs, bold face, etc). Is there a way to generate such a report using Python? I feel like there should be a way to do this using Microsoft Word/OpenOffice templates and Python, but I can't find anything advanced enough to get good formatting. Any

Formatted output in OpenOffice/Microsoft Word with Python

一笑奈何 提交于 2020-01-12 19:29:30
问题 I am working on a project (in Python) that needs formatted, editable output. Since the end-user isn't going to be technically proficient, the output needs to be in a word processor editable format. The formatting is complex (bullet points, paragraphs, bold face, etc). Is there a way to generate such a report using Python? I feel like there should be a way to do this using Microsoft Word/OpenOffice templates and Python, but I can't find anything advanced enough to get good formatting. Any

How to diagnose failed validation of Word Add-In when it works on my own setup?

这一生的挚爱 提交于 2020-01-12 10:54:40
问题 I'm developing an MS Word Add-In. I've tested it on both Windows and Mac, and it works fine for me. Microsoft requires its own validation of Add-Ins to make sure they work correctly, and my Add-In fails for them even though it works for me with the same version of Windows and Word. I had a phone call with the Microsoft Validation team, and their only suggestion was that I post a question on Stack Overflow so here goes! This is the version of Windows and Word that works for me but fails for

Creating a multi-level bullet list with Word.Interop

余生颓废 提交于 2020-01-12 05:37:05
问题 I need to create a multi-level bullet list via Microsoft.Office.Interop.Word and I am currently struggling with its (horrible) API (again). I've just created the following example (not dynamic yet, just for demonstration purposes) in a VSTO document-level project for Microsoft Office Word 2010 in the programming language C#: Word.Paragraph paragraph = null; Word.Range range = this.Content; paragraph = range.Paragraphs.Add(); paragraph.Range.Text = "Item 1"; paragraph.Range.ListFormat

how to use php to include an image in a word file?

≡放荡痞女 提交于 2020-01-12 05:24:07
问题 Somebody has asked me to make an app in php that will generate a .doc file with an image and a few tables in it. My first approach was: <?php function data_uri($file, $mime) { $contents = file_get_contents($file); $base64 = base64_encode($contents); return ('data:' . $mime . ';base64,' . $base64); } $file = 'new.doc'; $fh = fopen($file,'w'); $uri = data_uri('pic.png','image/png'); fwrite($fh,'<table border="1"><tr><td><b>something</b></td><td>something else</td></tr><tr><td></td><td></td></tr