Open Source Ruby Library for Word Document 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 supports several important features related to working with Word documents such as creating Word documents, modifying DOCX files, add paragraphs 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 section creation and 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 GEM.
Install Docx via GEM
gem install docx
Write to Existing DOCX 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 via Ruby Library
The open source Ruby Docx library allows accessing and reading Word DOCX files using just a couple of lines of Ruby code. Developers can create the document object from an existing DOCX file and can retrieve and display the content of the file.
Reading Tables from Word DOCX Files
Ruby DOCX library gives software developers the capability to access and read tables inside a DOCX file using Ruby commands. It allows to access rows, columns and cells of tables as well as provides support to iterate through tables using row-based or column-based iteration.