From e41ac71b2fac8b2a763a7c37f8bae10b8e0bea16 Mon Sep 17 00:00:00 2001 From: El Mau Date: Tue, 15 Mar 2022 22:02:26 -0600 Subject: [PATCH] Doc for ranges --- docs/source/calc_ranges.rst | 123 ++++++++++++++++++++++++++++++++++++ docs/source/calc_sheets.rst | 2 +- 2 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 docs/source/calc_ranges.rst diff --git a/docs/source/calc_ranges.rst b/docs/source/calc_ranges.rst new file mode 100644 index 0000000..583e1aa --- /dev/null +++ b/docs/source/calc_ranges.rst @@ -0,0 +1,123 @@ +Ranges +------ + +By selection +^^^^^^^^^^^^ + +.. code-block:: python + + doc = app.active + selection = doc.selection + app.debug(selection) + +Count +^^^^^ + +.. code-block:: python + + selection = doc.selection + count = len(selection) + app.debug(count) + +Iter +^^^^ + +.. code-block:: python + + selection = doc.selection + for rango in selection: + app.debug(rango) + +Get +^^^ + +* By index + +.. code-block:: python + + selection = doc.selection + rango = selection[1] + app.debug(rango) + +* By name + +.. code-block:: python + + selection = doc.selection + rango = selection['Sheet1.D9:E11'] + app.debug(rango) + + +New ranges container +^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: python + + ranges = doc.ranges + +Add +^^^ + +.. code-block:: python + + doc = app.active + sheet = doc.active + rangos = doc.ranges + rangos.add(sheet['A1:B2']) + rangos.add(sheet['D5:F10']) + app.debug(rangos) + +Remove +^^^^^^ + +.. code-block:: python + + rangos.remove(sheet['A1:B2']) + +If contains +^^^^^^^^^^^ + +.. code-block:: python + + result = sheet['D5:F10'] in rangos + app.debug(result) + +Get same range in all sheets +^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +.. code-block:: python + + rangos = doc.get_ranges('A1:C5') + app.debug(rangos) + +Names +^^^^^ + +.. code-block:: python + + app.debug(rangos.names) + +Get and set data +^^^^^^^^^^^^^^^^ + +.. note:: + + Each range of data must be the exact size of each range. + +.. code-block:: python + + rangos = doc.get_ranges('A1:C5') + data = rangos.data + app.debug(data) + rangos.data = data + +Style +^^^^^ + +Apply the same style to all ranges. + +.. code-block:: python + + rangos = doc.get_ranges('A1:C5') + rangos.style = 'Good' + diff --git a/docs/source/calc_sheets.rst b/docs/source/calc_sheets.rst index 4e06ac3..63af043 100644 --- a/docs/source/calc_sheets.rst +++ b/docs/source/calc_sheets.rst @@ -65,7 +65,7 @@ Count | Iter ----- +^^^^ .. code-block:: python