Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to generate .docx files without having MS Word installed?

I want to use "OLE automation" (or whatever it's called now) to generate a Word document.

I assume that it's possible to perform the following programmatically:

Set page size (height, width, margin vals)
Set font type/name, style, and size
Add page numbering
Add pages
Insert page breaks

What I'm not sure of is if I need to have MS Word on my system to do this (to have the necessary DLLs, perhaps)? I use Open Office (I like it, and it's free), but I reckon controlling the creation of docs programmatically is probably easier/better documented for MS Word than it is for Open Office and/or Libre Office - that's why I'm strongly considering making this "rendezvous with Redmond."

This question is tangentially related to this one

If Google Docs is a possibility here, I'd be willing to have a "meeting with Mountain View" but I know nothing about that file format or whether it can be "automated" etc.

I need to end up with something that I can either convert to a PDF file or a DOCX file. Open Office can open DOCX and convert files to PDF, but I don't know about Google Docs.

like image 707
B. Clay Shannon-B. Crow Raven Avatar asked Dec 24 '13 16:12

B. Clay Shannon-B. Crow Raven


People also ask

How do I make a DOCX file without word?

Google Docs Google Docs is a browser-based word processor similar to Word Online and features complete support for the DOC and DOCX formats. All you need is a Google Account to get started.

Can you open DOCX without word?

You can open a . DOCX file with a Windows or Mac computer and mobile devices. If you don't have Microsoft Word, you can use Google Drive to open the file.


2 Answers

I've found https://docx.codeplex.com/ to be very useful in dynamically building docx documents.

like image 55
Chris W Avatar answered Nov 14 '22 21:11

Chris W


Yes, it is possible. Check this link: http://www.microsoft.com/en-us/download/details.aspx?id=30425 this is a library for open xml documents (*.docx, *.xlsx and powerpoint files)

like image 38
Davecz Avatar answered Nov 14 '22 22:11

Davecz