ooxml_parser is a Ooxml files (docx, xlsx, pptx) parser written in Ruby.
-
Install
magic
lib, required byruby-filemagic
Mac OS:brew install libmagic
Debian-Based Linux:
sudo apt-get install libmagic-dev
Centos-Based Linux:
sudo yum install file-devel
-
Install gem by command:
gem install ooxml_parser
Parse a docx file
require 'ooxml_parser'
docx = OoxmlParser::Parser.parse('spec/document/document_properties/page_count.docx')
p docx.document_properties.pages # 2
Accuracy of digits in fraction part Default is 2 digits in fraction part
OoxmlParser.configure do |config|
config.accuracy = 3
end