docx
docx copied to clipboard
Formattable elements
Textruns and Paragraphs can be created with formatting from a bookmark by supplying a hash to the bookmark methods:
insert_text_before(text, formatting={})insert_text_after(text, formatting={})insert_multiple_lines(text_array, formatting={})
Or applied to an already existing Run or Paragraph using
element.apply_formatting(formatting)
Textruns can also be formatted whilst changing the text with:
textrun.set_text(content, formatting={})
Allowed formatting for:
Text runs
- :italic => boolean
- :bold => boolean
- :underline => boolean
- :font => 'font_name'
- :font_size => font_size
- :color => color as hex string e.g. 'FF0000' for red
Paragraphs
- :alignment => 'center', 'left', 'right'
fixes #16