Mixin Named Range
Mixin class NRMixin for classes using Named Ranges.
Classes:
| Name | Description |
|---|---|
NRMixin |
Mixin for Named Range access. |
TableNamedExpressions |
Container of assignments of names to expressions, tag “table:named-expressions”. |
NRMixin
Bases: Element
Mixin for Named Range access.
Used by the following classes: Chart, Drawing, Presentation, Spreadsheet, Text.
Methods:
| Name | Description |
|---|---|
append_named_range |
Append a |
delete_named_range |
Delete a named range from the document by its name. |
get_named_range |
Retrieve a specific named range global to the document by its name. |
get_named_ranges |
Retrieve all named ranges ( |
set_named_range |
Create or update a named range in the document. |
Source code in odfdo/mixin_named_range.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
append_named_range
append_named_range(named_range: NamedRange) -> None
Append a NamedRange object to the document.
If a named range with the same name already exists, it will be replaced.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
named_range
|
NamedRange
|
The |
required |
Source code in odfdo/mixin_named_range.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | |
delete_named_range
delete_named_range(name: str) -> None
Delete a named range from the document by its name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the named range to delete. |
required |
Source code in odfdo/mixin_named_range.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | |
get_named_range
get_named_range(name: str) -> NamedRange | None
Retrieve a specific named range global to the document by its name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the named range to retrieve. |
required |
Returns:
| Type | Description |
|---|---|
NamedRange | None
|
NamedRange | None: The |
Source code in odfdo/mixin_named_range.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | |
get_named_ranges
get_named_ranges() -> list[NamedRange]
Retrieve all named ranges (NamedRange objects) global to the document.
Returns:
| Type | Description |
|---|---|
list[NamedRange]
|
list[NamedRange]: A list of |
Source code in odfdo/mixin_named_range.py
52 53 54 55 56 57 58 59 60 61 | |
set_named_range
set_named_range(
name: str,
crange: str | tuple | list,
table_name: str,
usage: str | None = None,
) -> None
Create or update a named range in the document.
A NamedRange element is created with the given parameters and inserted
into the document. If a named range with the same name already exists,
it will be replaced.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str
|
The name of the named range. |
required |
crange
|
str | tuple | list
|
The cell or cell range coordinate (e.g., “Sheet1.A1”, “Sheet1.A1:B2”, or a tuple/list of integers representing coordinates). |
required |
table_name
|
str
|
The name of the table to which the named range refers. |
required |
usage
|
str | None
|
Optional usage type (e.g., “print-range”, “filter”, “repeat-column”, “repeat-row”). |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in odfdo/mixin_named_range.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |
TableNamedExpressions
Bases: Element
Container of assignments of names to expressions, tag “table:named-expressions”.
(Mostly internal use). The following expressions may have names: - cell ranges, - Other expressions.
If the “table:named-expressions” element is used with a “table:table” element, the scope of the named expressions are local to that table element.
Source code in odfdo/mixin_named_range.py
30 31 32 33 34 35 36 37 38 39 40 41 42 43 | |
_properties
class-attribute
instance-attribute
_properties: tuple[PropDef | PropDefBool, ...] = ()
_tag
class-attribute
instance-attribute
_tag: str = 'table:named-expressions'