Questions tagged [ms-word]

For programming questions related to Microsoft's "Word" editor. Questions on general usage of the editor are off-topic for Stack Overflow; they should be asked on Super User instead.

Microsoft Word is a commercial document editing program. It features numerous text-editing tools for creating richly formatted documents.

It was first released in 1983 under the name Multi-Tool Word for Xenix systems. Subsequent versions were later written for several other platforms including IBM PCs running DOS (1983), the Apple Macintosh (1984), the AT&T Unix PC (1985), Atari ST (1986), SCO UNIX, OS/2, and Microsoft Windows (1989).

While it is a component of the system, is also sold as a standalone product. The current versions are Microsoft Word 2016 for Windows, Word Online (Office 365), and 2016 for Mac.

This is a generic tag for the Word family of products, and it is expected that questions using this tag relate to Word programming. Use version-specific tags to indicate the version you are programming against.

Related Tags:

18422 questions
2248
votes
44 answers

How do you display code snippets in MS Word preserving format and syntax highlighting?

Does anyone know a way to display code in Microsoft Word documents that preserves coloring and formatting? Preferably, the method would also be unobtrusive and easy to update. I have tried to include code as regular text which looks awful and gets…
Lawrence Barsanti
  • 27,683
  • 10
  • 43
  • 64
1121
votes
9 answers

What is a correct MIME type for .docx, .pptx, etc.?

For older *.doc documents, this was enough: header("Content-Type: application/msword"); What MIME type should I use for new .docx documents? Also, for pptx and xlsx documents?
Richard Knop
  • 73,317
  • 142
  • 374
  • 539
227
votes
9 answers

How do I convert Word files to PDF programmatically?

I have found several open-source/freeware programs that allow you to convert .doc files to .pdf files, but they're all of the application/printer driver variety, with no SDK attached. I have found several programs that do have an SDK allowing you to…
Shaul Behr
  • 33,989
  • 61
  • 233
  • 360
169
votes
10 answers

How do I render a Word document (.doc, .docx) in the browser using JavaScript?

I have successfully done code to display a PDF file in the browser instead of the "Open/Save" dialog. Now, I'm stuck trying to display a Word document in the browser. I want to display a Word document in Firefox, IE7+, Chrome etc. Can any one help?…
Pankaj
  • 2,241
  • 4
  • 12
  • 21
136
votes
15 answers

What is the best way to insert source code examples into a Microsoft Word document?

I have to write some documents that will include source code examples. Some of the examples will be written from the IDE, and others would be written in place. My examples are primarily in Java. As someone who is used to LaTeX, doing this in Word is…
Uri
  • 84,589
  • 46
  • 214
  • 312
112
votes
16 answers

Is there a Java API that can create rich Word documents?

I have a new app I'll be working on where I have to generate a Word document that contains tables, graphs, a table of contents and text. What's a good API to use for this? How sure are you that it supports graphs, ToCs, and tables? What are some…
billjamesdev
  • 14,133
  • 6
  • 48
  • 72
73
votes
17 answers

How can a Word document be created in C#?

I have a project where I would like to generate a report export in MS Word format. The report will include images/graphs, tables, and text. What is the best way to do this? Third party tools? What are your experiences?
Schmidty
  • 1,850
  • 1
  • 20
  • 18
64
votes
8 answers

Convert Word doc and docx format to PDF in .NET Core without Microsoft.Office.Interop

I need to display Word .doc and .docx files in a browser. There's no real client-side way to do this and these documents can't be shared with Google docs or Microsoft Office 365 for legal reasons. Browsers can't display Word, but can display PDF, so…
Keith
  • 133,927
  • 68
  • 273
  • 391
61
votes
4 answers

Inserting newlines in Word using OpenXML

I am using openxml WordProcessingDocument to open a Word template and replace placeholder x1 with a string. This works fine unless I need the string to contain a newline. How can I replace x1 with text may contain newlines that word would…
Danny
  • 2,633
  • 5
  • 28
  • 42
59
votes
10 answers

Create Word Document using PHP in Linux

Whats the available solutions for PHP to create word document in linux environment?
TechLearner
51
votes
10 answers

How can I convert a Word document to PDF?

How can I convert a Word document to PDF where the document contains various things, such as tables. When trying to use iText, the original document looks different to the converted PDF. Is there an open source API / library, rather than calling out…
magh
  • 639
  • 2
  • 13
  • 17
51
votes
4 answers

How to extract text from word file .doc,docx,.xlsx,.pptx php

There may be a scenario we need to get the text from word documents for the future use to search the string in the document uploaded by user like for searching in cv's/resumes and occurs a common problem that how to get the text , Open and read a…
M Khalid Junaid
  • 60,231
  • 8
  • 78
  • 110
50
votes
13 answers

.doc to pdf using python

I'am tasked with converting tons of .doc files to .pdf. And the only way my supervisor wants me to do this is through MSWord 2010. I know I should be able to automate this with python COM automation. Only problem is I dont know how and where to…
nik
  • 7,259
  • 11
  • 33
  • 40
49
votes
13 answers

Creating Microsoft Word (.docx) documents in Ruby

Is there an easy way to create Word documents (.docx) in a Ruby application? Actually, in my case it's a Rails application served from a Linux server. A gem similar to Prawn but for DOCX instead of PDF would be great!
Javier
  • 2,451
  • 4
  • 36
  • 55
49
votes
10 answers

How can I search a word in a Word 2007 .docx file?

I'd like to search a Word 2007 file (.docx) for a text string, e.g., "some special phrase" that could/would be found from a search within Word. Is there a way from Python to see the text? I have no interest in formatting - I just want to classify…
Gerry
  • 935
  • 1
  • 7
  • 16
1
2 3
99 100