Paragraph module
- class Paragraph.Paragraph
Bases:
BodyRegion,IParagraph,IStyleHolder,ICompositeObjectRepresents a paragraph in a document.
- AppendBookmarkEnd(name: str) BookmarkEnd
Appends the end of a bookmark with the specified name to the paragraph.
- Parameters:
name – The name of the bookmark.
- Returns:
A BookmarkEnd object.
- AppendBookmarkStart(name: str) BookmarkStart
Appends the start of a bookmark with the specified name to the paragraph.
- Parameters:
name – The name of the bookmark.
- Returns:
A BookmarkStart object.
- AppendBreak(breakType: BreakType) Break
Appends a break to the end of the paragraph.
- Parameters:
breakType – The type of break.
- Returns:
The appended break.
- AppendChart
- <summary>
Append an chart object into the document and scales it to the specified size.
</summary>
- AppendCheckBox
Appends a checkbox form field to the paragraph.
- Returns:
The appended checkbox form field.
- Return type:
- AppendComment(text: str) Comment
Appends a comment to the paragraph.
- Parameters:
text – The comment text.
- Returns:
A Comment object.
- AppendCommentMark(type: CommentMarkType) CommentMark
Appends a comment mark to the paragraph.
- Parameters:
type – The type of the comment mark.
- Returns:
A CommentMark object.
- AppendDropDownFormField
Appends a dropdown form field to the paragraph.
- Returns:
The appended dropdown form field.
- Return type:
- AppendField(fieldName: str, fieldType: FieldType) Field
Appends a field to this paragraph.
- AppendFieldMark(type: FieldMarkType) FieldMark
Appends a field mark to the paragraph.
- Parameters:
type – The type of the field mark.
- Returns:
A FieldMark object.
- AppendFootnote
Appends a footnote to the paragraph.
- Parameters:
type (FootnoteType) – The type of the footnote.
- Returns:
The appended footnote.
- Return type:
- AppendHTML(html: str)
Appends HTML to the paragraph.
- Parameters:
html – The HTML content.
- AppendHorizonalLine() ShapeObject
Appends a horizontal line to the end of the paragraph.
- Returns:
The appended horizontal line.
- Return type:
- AppendHyperlink
Appends a hyperlink to the paragraph.
- Parameters:
link – The link URL.
text – The text to display.
type – The type of the hyperlink.
- Returns:
A Field object.
- AppendOleObject
Appends an OLE object to the paragraph.
- Parameters:
oleStream – The OLE object (file) stream.
olePicture – The OLE picture.
type – The type of OLE object.
- Returns:
The appended OLE object.
- AppendPermEnd(id: str) PermissionEnd
Appends the end of a permission with the specified id to the paragraph.
- Parameters:
id – The id of the permission.
- Returns:
A PermissionEnd object.
- AppendPermStart(id: str) PermissionStart
Appends the start of a permission with the specified id to the paragraph.
- Parameters:
id – The id of the permission.
- Returns:
A PermissionStart object.
- AppendPicture
Appends a picture to the paragraph.
- Parameters:
imgFile – The image file.
- Returns:
The appended picture.
- AppendRTF
Appends RTF to the paragraph.
- Parameters:
rtfcode – The RTF code.
addtolastsection – When True, the RTF is added to the last section of the document.
- AppendShape(width: float, height: float, shapeType: ShapeType) ShapeObject
Appends a shape to the end of the paragraph.
- Parameters:
width (float) – The width of the shape.
height (float) – The height of the shape.
shapeType (ShapeType) – The type of the shape.
- Returns:
The appended shape.
- Return type:
- AppendShapeGroup(width: float, height: float) ShapeGroup
Appends a shape group to the end of the paragraph.
- Parameters:
width – The width of the shape group.
height – The height of the shape group.
- Returns:
The appended shape group.
- AppendSymbol(characterCode: int) Symbol
Appends a special symbol to the end of the paragraph.
- Parameters:
characterCode (int) – The character code.
- Returns:
The appended symbol.
- Return type:
- AppendTOC(lowerLevel: int, upperLevel: int) TableOfContent
Appends a table of content to the paragraph.
- Parameters:
lowerLevel – The starting heading level of the table of content.
upperLevel – The ending heading level of the table of content.
- Returns:
The appended table of content.
- AppendText(text: str) TextRange
Appends text to the end of this paragraph.
- Parameters:
text (str) – The text to append.
- Returns:
The appended text range.
- Return type:
- AppendTextBox(width: float, height: float) TextBox
Appends a textbox to the end of the paragraph.
- Parameters:
width (float) – The width of the textbox.
height (float) – The height of the textbox.
- Returns:
The appended textbox.
- Return type:
- AppendTextFormField
Appends a text form field to the paragraph.
- Parameters:
defaultText (str) – The default text. Pass “null” to insert default Word text.
- Returns:
The appended text form field.
- Return type:
- ApplyStyle
Applies the specified style to this paragraph.
- Parameters:
styleName (str) – The name of the style to apply.
- property BreakCharacterFormat: CharacterFormat
Gets character format for the break symbol.
- Returns:
The character format.
- property CharCount: int
Gets the character count of this paragraph.
- Returns:
The character count of this paragraph.
- Return type:
int
- property CharCountIncludeSpace: int
Gets the character count including spaces of this paragraph.
- Returns:
The character count including spaces of this paragraph.
- Return type:
int
- property ChildObjects: DocumentObjectCollection
Gets the child objects.
- Returns:
The child objects.
- property DocumentObjectType: DocumentObjectType
Gets the type of the document object.
- Find
- FindAllPattern(pattern: Regex) List[TextSelection]
Returns all entries of matchString regex.
- Parameters:
pattern (Regex) – The regex pattern.
- Returns:
The found text selections.
- Return type:
List[TextSelection]
- FindAllString(matchString: str, caseSensitive: bool, wholeWord: bool) List[TextSelection]
Returns all entries of matchString string, taking into consideration caseSensitive and wholeWord options. :param matchString: The string to match. :param caseSensitive: If True, the match is case sensitive. :param wholeWord: If True, the match must be a whole word. :return: A list of TextSelection objects.
- property Format: ParagraphFormat
Gets paragraph format.
- Returns:
The paragraph format.
- property Frame: Frame
- GetIndex(entity: IDocumentObject) int
Gets the index.
- Parameters:
entity – The document object.
- Returns:
The index.
- GetListFormatForApplyStyle() ListFormat
Gets the list format for apply style.
- Returns:
The list format.
- GetStyle() ParagraphStyle
Gets the style of this paragraph.
- Returns:
The style of this paragraph.
- Return type:
- InsertSectionBreak
Inserts the section break.
- property IsEndOfDocument: bool
Gets a value indicating whether this paragraph is end of document.
- Returns:
If this paragraph is end of document, set to True.
- Return type:
bool
Gets a value indicating whether this paragraph is end of header/footer.
- Returns:
If this paragraph is end of header/footer, set to True.
- Return type:
bool
- property IsEndOfSection: bool
Gets a value indicating whether this paragraph is end of section.
- Returns:
If this paragraph is end of section, set to True.
- Return type:
bool
- property IsFrame: bool
Gets a value indicating whether this instance is a frame.
- property IsInCell: bool
Gets a value indicating whether this paragraph is in cell.
- Returns:
If this paragraph is in cell, set to True.
- Return type:
bool
- property Items: ParagraphItemCollection
Gets paragraph items.
- Returns:
The items.
- property ListFormat: ListFormat
Gets format of the list for the paragraph.
- Returns:
The list format.
- property ListText: str
Gets the list text.
The value of the list number is obtained by dynamic calculation. The value of the list number of the paragraph directly may be incorrect. To obtain the correct value, you need to traverse all paragraphs in the document.
- property ParentSection: Section
Gets the parent section of the paragraph. :return: The parent section of the paragraph.
- RemoveAbsPosition()
Removes the absolute position of this paragraph.
- RemoveFrame()
Remove a frame.
- Replace
- property StyleName: str
Gets paragraph style name.
- Returns:
The style name.
- property Text: str
Gets paragraph text.
- Returns:
The paragraph text.
- Remarks:
All internal formatting will be cleared when new text is set.
- UpdateListValue() str
Updates the list value.
The value of the list number is obtained by dynamic calculation. The value of the list number of the paragraph directly may be incorrect. To obtain the correct value, you need to traverse all paragraphs in the document.
- Returns:
The value string.
- property WordCount: int
Gets the word count of this paragraph.
- Returns:
The word count of this paragraph.
- Return type:
int
- get_Item(index: int) ParagraphBase
Gets paragraph item by index.
- Parameters:
index – The index.
- Returns:
The paragraph item.
