Document
Overview
Document is a class in Aspose.Words FOSS for Python.
Inherits from: BaseModel.
The Document class represents a Word document and provides the get_text() method to extract the full plain‑text content of the file.
This class provides 5 methods for working with Document objects in Python programs.
Available methods include: find_style, get_child_nodes, get_list, headings, resolve_list_level.
All public members are accessible to any Python application after installing the Aspose.Words FOSS for Python package.
Properties: all_paragraphs, all_tables, default_tab_stop, doc_defaults_font, footer_paragraphs, header_paragraphs, and 8 more.
Properties
| Name | Type | Access | Description |
|---|---|---|---|
header_paragraphs | list[Paragraph] | Read | Flat list of header paragraphs collected from all sections. |
footer_paragraphs | list[Paragraph] | Read | Flat list of footer paragraphs collected from all sections. |
all_paragraphs | list[Paragraph] | Read | Flat list of direct body paragraphs only (excludes table cells). |
tables | list[Table] | Read | Flat list of all top-level tables in the body. |
all_tables | list[Table] | Read | Alias for tables (backwards compatibility). |
text | str | Read | Plain text of the whole document (body paragraphs only). |
type | str | Read | Gets the type. |
default_tab_stop | float | Read | Gets the default tab stop. |
page_color | str | Read | Gets the page color. |
page_count | int | Read | Gets the page count. |
doc_defaults_font | Optional[Font] | Read | Gets the doc defaults font. |
styles | list[Style] | Read | Gets the styles. |
lists | list[DocList] | Read | Gets the lists. |
sections | list[Section] | Read | Gets the sections. |
Methods
| Signature | Description |
|---|---|
get_child_nodes(node_type: int, deep: bool) → list | Child nodes, optionally filtered by :class:NodeType. |
get_list(list_id: int) → DocList | None | Look up a list definition by ID. |
resolve_list_level(list_id: int, level_num: int) → ListLevel | None | Resolve the effective ListLevel for a list-id + level pair, |
applying any ``<w:lvlOverride>`` formatting from the concrete
``<w:num>`` element. |
| find_style(name: str) → Style \| None | Look up a style by its exact name. |
| headings(max_level: int) → list[Paragraph] | All heading paragraphs up to a given outline level. |