Last updated on July 25, 2020 by Dan Nanni
If you want to create a Word document without using Microsoft Word on Linux, one way of course is to use Linux-based office suite software, such as LibreOffice, WPS Office or ONLYOFFICE. These Linux-based office suites typically provide options to convert documents to Microsoft Word format.
If you do not want to install such heavyweight office suite program, an alternative way is the following: prepare content in a plain text file and then convert the text file into a Word document.
For this purpose, you can use a command-line utility called pandoc
, which converts from one markup format to another from the command line.
pandoc
on Linux$ sudo apt-get install pandoc
$ sudo yum install pandoc
On CentOS, first enable EPEL repo, and then use yum
command.
$ sudo yum install pandoc
If you want to apply any formatting to a text file, you can use Markdown syntax in the text. The following is an example of a text file written in Markdown syntax.
My Title ======== Sub-title --------- This is a new paragraph. Different paragraphs need to be separated by blank lines. You can change the attributes of text as follows. *italic*, **bold**, `monospace`. You can also include a [link](http://example.com). Note that there must be no space between ] and (. This is my friend list: * Cathy * Julia * Lisa This is a numbered list: 1. Google 2. Facebook 3. Apple You can also include an image file by using the following format. ![alt text](/path/to/image.png "Title")
Once a text file is ready, run the following command to convert the text file into a Word document.
$ pandoc -o output.docx input.txt
This is the output of the generated Word document.
This website is made possible by minimal ads and your gracious donation via PayPal or credit card
Please note that this article is published by Xmodulo.com under a Creative Commons Attribution-ShareAlike 3.0 Unported License. If you would like to use the whole or any part of this article, you need to cite this web page at Xmodulo.com as the original source.
Xmodulo © 2021 ‒ About ‒ Write for Us ‒ Feed ‒ Powered by DigitalOcean