zaz/doc/build/_sources/main/calc_ranges2.rst.txt

125 lines
1.8 KiB
ReStructuredText

Manipulate ranges
~~~~~~~~~~~~~~~~~
**Not, not is necesary select range for manipulate**
Select
^^^^^^
* Select from doc
.. code-block:: python
doc = app.active
sheet = app.active_sheet
cell = sheet['A1']
doc.select(cell)
* Select in self range
.. code-block:: python
sheet = app.active_sheet
rango = sheet['A1:C5']
rango.select()
Move
^^^^
.. code-block:: python
sheet = app.active_sheet
rango = sheet['A1:C5']
rango.move(sheet['E6'])
* Move to other sheet
.. code-block:: python
rango.move(doc[-1]['E6'])
Insert
^^^^^^
* Default insert down
.. code-block:: python
sheet = app.active_sheet
rango = sheet['A1:C1']
rango.insert()
* Insert and move right
.. code-block:: python
rango.insert(app.CellInsertMode.RIGHT)
* Insert entire rows
.. code-block:: python
rango.insert(app.CellInsertMode.ROWS)
* Insert entire columns
.. code-block:: python
rango.insert(app.CellInsertMode.COLUMNS)
Delete
^^^^^^
* Default move up
.. code-block:: python
sheet = app.active_sheet
rango = sheet['A1:C1']
rango.delete()
* Delete and move left
.. code-block:: python
rango.delete(app.CellDeleteMode.LEFT)
* Delete entire rows
.. code-block:: python
rango.delete(app.CellDeleteMode.ROWS)
* Delete entire columns
.. code-block:: python
rango.delete(app.CellDeleteMode.COLUMNS)
Copy
^^^^
* Using native method `copyRange`, current range always should be a cell and source should be a range.
.. code-block:: python
sheet = app.active_sheet
cell = sheet['A5']
source = sheet['D1:E4']
cell.copy_from(source)
* From range to cell
.. code-block:: python
sheet = app.active_sheet
rango = sheet['A1:C5']
target = sheet['E1']
rango.copy_to(target)