Open Source Ruby Library for Word Documents Processing
Free Ruby API that enables software developers to generate and Edit Microsoft Word files, manage headers & footers, insert and edit tables, and much more.
The DocX API has included support for several important features related to working with Word documents such as creating Word documents, modifying DOCX files, add a paragraph to a word file, add and manage headers & footers, insert and edit tables, bullet and numbering support, Table of content creation, set document margins, set page size, text alignment, Manage fonts and font sizes, document sections creation and many more.
At A Glance
An overview of Docx features.
- Create Word files
- Modify Word files
- Document protection
- Document margins
- Text direction
- Text alignment
- Manage fonts
- Set text color
- Set page numbering
- Create sections
- Add headers or footers
- Manage paragraphs
Docx supports popular Word Processing file formats listed below.
Docx requires Ruby 2.5 or later.
Getting Started with Docx
The recommended way to install is using npm. Please use the following command to your application's Gemfile
Install Docs via npm
gem install docx
Write to Existing DOCX Files via Ruby
The Ruby Docx library enables software developers to open existing DOCX files and update the content inside the file inside your own Ruby applications. To open the file you need to provide the correct path of the existing DOCX file. Once you can have access to the documents you can easily add a single line of text or paragraphs, substitute text, remove unwanted content, modify the existing text, and so on. Once everything is properly completed you can save the document to the specified path.
Reading Docx File via Ruby Library
The open source Ruby Docx library has provided functionality for accessing and reading MS word DOCX files using a couple of lines of Ruby code. Developers can easily create the document object for our existing docx file and can retrieve and display the content of the file with just a couple of lines of Ruby code. You easily display a particular paragraph or bookmarks. You can also display files from a buffer.
Reading Tables in Word DOCX Files
The open source Ruby DOCX library gives software developers the capability to access and read tables inside a DOCX file using Ruby commands. You can easily access rows, columns and cells of tables with just couple of lines of code. The library supports iterate through tables, Row-based iteration and Column-based iteration.