openpyxl.cell.rich_text module

RichText definition

class openpyxl.cell.rich_text.CellRichText(*args)[source]

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 object to the end of the list.


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


Extend list by appending elements from the iterable.

classmethod from_tree(node)[source]

Return the full XML representation

class openpyxl.cell.rich_text.TextBlock(font, text)[source]

Bases: Strict

Represents text string in a specific format

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


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


Values must be of type <class ‘str’>