Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formattable elements #26

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

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