ooodev.adapter.sheet.named_ranges_partial module
- class ooodev.adapter.sheet.named_ranges_partial.NamedRangesPartial(component, interface=com.sun.star.sheet.XNamedRanges)[source]
Bases:
NameAccessPartial
[NamedRangeComp
]Partial Class for XNamedRanges.
- __init__(component, interface=com.sun.star.sheet.XNamedRanges)[source]
Constructor
- Parameters:
component (XNamedRanges) – UNO Component that implements
com.sun.star.sheet.XNamedRanges
.interface (UnoInterface, optional) – The interface to be validated. Defaults to
XNamedRanges
.
- Return type:
None
- add_new_by_name(name, content, position, type_enum=0)[source]
Adds a new named range to the collection.
A cell range address is one possible content of a named range.
- Parameters:
name (str) – The name of the new named range.
content (str) – the formula expression.
position (CellAddress) – Specifies the base address for relative cell references.
type_enum (int | NamedRangeFlagEnum, optional) – A combination of flags that specify the type of a named range. Defaults to
0
.
- Return type:
None
Note
CellAddress
can be imported fromcom.sun.star.table
.NamedRangeFlagEnum
is a flags enum and can be imported fromooo.dyn.sheet.named_range_flag
.
- add_new_from_titles(src, border)[source]
Creates named cell ranges from titles in a cell range.
The names for the named ranges are taken from title cells in the top or bottom row, or from the cells of the left or right column of the range (depending on the parameter aBorder. The named ranges refer to single columns or rows in the inner part of the original range, excluding the labels.
Example - The source range is
A1:B3
. The named ranges shall be created using row titles. This requiresBorder.TOP
for the second parameter. The method creates two named ranges. The name of the first is equal to the content of cellA1
and contains the range$Sheet.$A$2:$A$3
(excluding the title cell). The latter named range is named using cell B1 and contains the cell range address$Sheet.$B$2:$B$3
.- Parameters:
src (CellRangeAddress) – The cell range containing the titles.
border (Border) – Specifies the border of the cell range that contains the titles.
- Return type:
None
Note
CellRangeAddress
can be imported fromcom.sun.star.table
.Border
is an enum and can be imported fromooo.dyn.sheet.border
.
- output_list(out_pos)[source]
Writes a list of all named ranges into the document.
The first column of the list contains the names. The second column contains the contents of the named ranges.
- Return type:
None
- Parameters:
out_pos (CellAddress) –
Note
CellAddress
can be imported fromcom.sun.star.table
.