# openpyxl.cell.rich_text module

RichText definition

class openpyxl.cell.rich_text.CellRichText(*args)

  Bases: `list`

  Represents a rich text string.

  Initialize with a list made of pure strings or `TextBlock` elements Can index object to access or modify individual rich text elements it also supports the + and += operators between rich text strings There are no user methods for this class

  operations which modify the string will generally call an optimization pass afterwards, that merges text blocks with identical formats, consecutive pure text strings, and remove empty strings and empty text blocks

  append(arg)

    Append object to the end of the list.

  as_list()

    Returns a list of the strings contained. The main reason for this is to make editing easier.

  extend(arg)

    Extend list by appending elements from the iterable.

  classmethod from_tree(node)
  to_tree()

    Return the full XML representation

class openpyxl.cell.rich_text.TextBlock(font, text)

  Bases: `Strict`

  Represents text string in a specific format

  This class is used as part of constructing a rich text strings.

  font

    Values must be of type <class ‘openpyxl.cell.text.InlineFont’>

  text

    Values must be of type <class ‘str’>

  to_tree()