Get visible now return ranges object
This commit is contained in:
parent
37acf3cc06
commit
87c8ead015
|
@ -157,13 +157,13 @@ Copy
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
sheet = doc[0]
|
sheet = doc[0]
|
||||||
doc.copy(sheet, 'OtherSheet')
|
doc.copy_sheet(sheet, 'OtherSheet')
|
||||||
|
|
||||||
* By name
|
* By name
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
doc.copy('Sheet1', 'Sheet2')
|
doc.copy_sheet('Sheet1', 'Sheet2')
|
||||||
|
|
||||||
* From sheet
|
* From sheet
|
||||||
|
|
||||||
|
|
|
@ -21,3 +21,18 @@ Automatic calculate size range.
|
||||||
)
|
)
|
||||||
sheet['A1'].data = data
|
sheet['A1'].data = data
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
|
Copy visible cells
|
||||||
|
^^^^^^^^^^^^^^^^^^
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
doc = app.active
|
||||||
|
rangos = doc.active['A1'].current_region.visible
|
||||||
|
doc.select(rangos)
|
||||||
|
doc.copy()
|
||||||
|
|
||||||
|
doc.active['A15'].select()
|
||||||
|
doc.paste()
|
||||||
|
|
||||||
|
|
|
@ -1469,7 +1469,7 @@ class LOCalc(LODocument):
|
||||||
self._sheets.removeByName(name)
|
self._sheets.removeByName(name)
|
||||||
return
|
return
|
||||||
|
|
||||||
def copy(self, name, new_name='', pos=-1):
|
def copy_sheet(self, name, new_name='', pos=-1):
|
||||||
if isinstance(name, LOCalcSheet):
|
if isinstance(name, LOCalcSheet):
|
||||||
name = name.name
|
name = name.name
|
||||||
index = pos
|
index = pos
|
||||||
|
@ -2624,8 +2624,8 @@ class LOCalcRange(object):
|
||||||
def visible(self):
|
def visible(self):
|
||||||
cursor = self.cursor
|
cursor = self.cursor
|
||||||
rangos = cursor.queryVisibleCells()
|
rangos = cursor.queryVisibleCells()
|
||||||
rangos = [LOCalcRange(self.sheet[r.AbsoluteName].obj) for r in rangos]
|
rangos = LOCalcRanges(rangos)
|
||||||
return tuple(rangos)
|
return rangos
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def merged_area(self):
|
def merged_area(self):
|
||||||
|
@ -3001,6 +3001,10 @@ class LOCalcRanges(object):
|
||||||
self._obj = obj
|
self._obj = obj
|
||||||
self._ranges = {}
|
self._ranges = {}
|
||||||
self._index = 0
|
self._index = 0
|
||||||
|
for r in obj:
|
||||||
|
sheet = r.Spreadsheet
|
||||||
|
rango = LOCalcRange(sheet[r.AbsoluteName])
|
||||||
|
self._ranges[rango.name] = rango
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
return self
|
return self
|
||||||
|
|
Loading…
Reference in New Issue