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(arg)[source]

Append object to the end of the list.

as_list()[source]

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

extend(arg)[source]

Extend list by appending elements from the iterable.

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

Bases: openpyxl.descriptors.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’>