lpod.paragraph

class lpod.paragraph.odf_paragraph(native_element)

Bases: lpod.element.odf_element

Specialised element for paragraphs.

get_formatted_text(context)
insert_annotation(annotation_element=None, after=None, body=None, creator=None, date=None)
insert_note(note_element=None, after=None, note_class='footnote', note_id=None, citation=None, body=None, *args, **kw)
insert_variable(variable_element, after)
set_bookmark(name, before=None, after=None, position=0, role=None, content=None)

Insert a bookmark before or after the characters in the text which match the regex before/after. When the regex matches more of one part of the text, position can be set to choose which part must be used. If before and after are None, we use only position that is the number of characters. So, by default, this function inserts a bookmark before the first character of the content. Role can be None, “start” or “end”, we insert respectively a position bookmark a bookmark-start or a bookmark-end. If content is not None these 2 calls are equivalent:

paragraph.set_bookmark("bookmark", content="xyz")

and:

paragraph.set_bookmark("bookmark", before="xyz", role="start")
paragraph.set_bookmark("bookmark", after="xyz", role="end")

If position is a 2-tuple, these 2 calls are equivalent:

paragraph.set_bookmark("bookmark", position=(10, 20))

and:

paragraph.set_bookmark("bookmark", position=10, role="start")
paragraph.set_bookmark("bookmark", position=20, role="end")

Arguments:

name – str

before – unicode regex

after – unicode regex

position – int or (int, int)

role – None, “start” or “end”

content – unicode regex

Make a link from text content matching the regex OR the positional arguments.

set_span(style, regex=None, offset=None, length=0)

Apply the given style to text content matching the regex OR the positional arguments offset and length.

Arguments:

style – style element or name

regex – unicode regular expression

offset – int

length – int

lpod.paragraph.odf_create_line_break()
lpod.paragraph.odf_create_paragraph(text=None, style=None)

Create a paragraph element of the given style containing the optional given text.

Arguments:

style – unicode

text – unicode

Return: odf_element

lpod.paragraph.odf_create_undividable_space(number=1)

Arguments:

number – int

Return odf_element