This repository was archived by the owner on Dec 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Very minimal Ruby docx editor. It let you make string replacement and inserting new paragraph using xml
License
oliamb/docxedit
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
Ruby Docx Edit
==============
A very minimal Ruby library that let you edit .docx file in some simple way
* make string replacement in .docx document
* insert new paragraphe using XML before or after a block of text
This is not meant to be fully functional or even completed in the future, take this code if you want at your own risk.
require 'docxedit'
doc = DocxEdit::Docx.new('mydocfile.docx')
doc.contains? /A simple string/ #return true if regexp is match in one of the document xml node
doc.replace(/str_to_find/, "replacement") #replace the matched string with "replacement" string
block = doc.find_block_with_content("[[EXACT block content]]") #return a ContentBlock object
# insert a new block of text before block
doc.insert(:before, block, ContentBlock.new("<w:p><w:r>A new block for this file.</w:r></w:p>", "A new block for this file."))
VERSIONS
========
0.0.1 First release
ROADMAP
=======
No more development planned for now
homepage: https://github.com/oliamb/docxeditAbout
Very minimal Ruby docx editor. It let you make string replacement and inserting new paragraph using xml
Resources
License
Stars
Watchers
Forks
Packages 0
No packages published