Skip to content

Conversation

@englertjoseph
Copy link

Textruns and Paragraphs can be created with formatting from a bookmark by supplying a hash to the bookmark methods:

  1. insert_text_before(text, formatting={})
  2. insert_text_after(text, formatting={})
  3. 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

font color?

1 participant