Bases: lpod.element.odf_element
Specialised element for paragraphs.
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.
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
Create a paragraph element of the given style containing the optional given text.
Arguments:
style – unicode
text – unicode
Return: odf_element
Arguments:
number – int
Return odf_element