IDocument module

class IDocument.IDocument

Bases: ICompositeObject, IDocumentObject

Interface for a document object.

abstract AddListStyle(listType: ListType, styleName: str) ListStyle

Adds a new list style to the document and returns it.

abstract AddParagraphStyle(styleName: str) ParagraphStyle

Adds a new paragraph style to the document and returns it.

abstract AddSection() Section

Adds a new section to the document and returns it.

abstract AddStyle(builtinStyle: BuiltinStyle) Style

Adds a new style to the document and returns it.

abstract property Background: Background

Returns the background of the document.

abstract property Bookmarks: BookmarkCollection

Returns the collection of bookmarks in the document.

abstract property BuiltinDocumentProperties: BuiltinDocumentProperties

Returns the built-in document properties.

abstract Clone() Document

Creates a clone of the document and returns it.

abstract property Comments: CommentsCollection

Returns the collection of comments in the document.

abstract CreateMinialDocument()

Creates a minimal document.

abstract CreateParagraph() Paragraph

Creates a new paragraph in the document and returns it.

abstract property CustomDocumentProperties: CustomDocumentProperties

Returns the custom document properties.

abstract Encrypt(password: str)

Encrypts the document with the specified password.

FindString

Finds the given string in the document and returns the text selection.

abstract GetProtectionType() ProtectionType

Returns the protection type of the document.

abstract GetText() str

Returns the text content of the document.

abstract property HasChanges: bool

Returns True if the document has changes, False otherwise.

ImportContent
abstract property IsUpdateFields: bool

Returns True if the document is set to update fields, False otherwise.

abstract property LastParagraph: Paragraph

Returns the last paragraph in the document.

abstract property LastSection: Section

Returns the last section in the document.

abstract property ListStyles: ListStyleCollection

Returns the collection of list styles in the document.

LoadFromFile

Loads the document from the specified file.

abstract LoadFromFileInReadMode(strFileName: str, fileFormat: FileFormat)

Loads the document from the specified file in read mode with the specified file format.

abstract LoadFromStream(stream: Stream, fileFormat: FileFormat)

Loads the document from the specified stream with the specified file format.

abstract property MailMerge: MailMerge

Returns the mail merge object of the document.

abstract property Properties: DocumentProperties

Returns the properties of the document.

Protect

Protects the document with the specified protection type.

abstract RemoveEncryption()

Removes the encryption from the document.

Replace
ReplaceInLine
abstract ResetFindState()

Resets the find state of the document.

SaveToFile

Saves the document to the specified stream with the specified file format.

abstract property Sections: SectionCollection

Returns the collection of sections in the document.

abstract SetProtectionType(value: ProtectionType)

Sets the protection type of the document.

abstract property Styles: StyleCollection

Returns the collection of styles in the document.

abstract property TOC: TableOfContent

Returns the table of contents in the document.

abstract property TextBoxes: TextBoxCollection

Returns the collection of text boxes in the document.

abstract UpdateWordCount()

Updates the word count of the document.

abstract property Variables: VariableCollection

Returns the collection of variables in the document.

abstract property ViewSetup: ViewSetup

Returns the view setup of the document.

abstract property Watermark: WatermarkBase

Returns the watermark of the document.