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