Add document for sheet properties
This commit is contained in:
parent
4bf03e582d
commit
ab28969dce
|
@ -266,11 +266,11 @@ Sort
|
||||||
Name
|
Name
|
||||||
^^^^
|
^^^^
|
||||||
|
|
||||||
* Name visible by the user.
|
Name visible by the user.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
sheet = app.active_sheet
|
sheet = doc.active
|
||||||
app.msgbox(sheet.name)
|
app.msgbox(sheet.name)
|
||||||
sheet.name = 'NewName'
|
sheet.name = 'NewName'
|
||||||
app.msgbox(sheet.name)
|
app.msgbox(sheet.name)
|
||||||
|
@ -279,11 +279,11 @@ Name
|
||||||
Code name
|
Code name
|
||||||
^^^^^^^^^
|
^^^^^^^^^
|
||||||
|
|
||||||
* Name only accessible by code.
|
Only accessible by code.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
sheet = app.active_sheet
|
sheet = doc.active
|
||||||
app.msgbox(sheet.code_name)
|
app.msgbox(sheet.code_name)
|
||||||
sheet.code_name = 'my_name'
|
sheet.code_name = 'my_name'
|
||||||
app.msgbox(sheet.code_name)
|
app.msgbox(sheet.code_name)
|
||||||
|
@ -292,11 +292,11 @@ Code name
|
||||||
Visible
|
Visible
|
||||||
^^^^^^^
|
^^^^^^^
|
||||||
|
|
||||||
* Apply only with spreadsheet with two or more sheets.
|
Apply only with spreadsheet with two or more sheets.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
sheet = app.active_sheet
|
sheet = doc.active
|
||||||
app.msgbox(sheet.visible)
|
app.msgbox(sheet.visible)
|
||||||
sheet.visible = not sheet.visible
|
sheet.visible = not sheet.visible
|
||||||
app.msgbox(sheet.visible)
|
app.msgbox(sheet.visible)
|
||||||
|
@ -306,11 +306,11 @@ Visible
|
||||||
Is protected
|
Is protected
|
||||||
^^^^^^^^^^^^
|
^^^^^^^^^^^^
|
||||||
|
|
||||||
* If sheet is protected with password.
|
If sheet is protected with password.
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
sheet = app.active_sheet
|
sheet = doc.active
|
||||||
app.msgbox(sheet.is_protected)
|
app.msgbox(sheet.is_protected)
|
||||||
|
|
||||||
|
|
||||||
|
@ -319,7 +319,7 @@ Set password
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
sheet = app.active_sheet
|
sheet = doc.active
|
||||||
sheet.password = 'letmein'
|
sheet.password = 'letmein'
|
||||||
app.msgbox(sheet.is_protected)
|
app.msgbox(sheet.is_protected)
|
||||||
|
|
||||||
|
@ -329,7 +329,7 @@ Remove password
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
sheet = app.active_sheet
|
sheet = doc.active
|
||||||
sheet.password = 'letmein'
|
sheet.password = 'letmein'
|
||||||
app.msgbox(sheet.is_protected)
|
app.msgbox(sheet.is_protected)
|
||||||
|
|
||||||
|
@ -342,7 +342,7 @@ Tab color
|
||||||
|
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
sheet = app.active_sheet
|
sheet = doc.active
|
||||||
app.msgbox(sheet.color)
|
app.msgbox(sheet.color)
|
||||||
|
|
||||||
sheet.color = 'red'
|
sheet.color = 'red'
|
||||||
|
@ -359,6 +359,7 @@ Document parent
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
doc = sheet.doc
|
doc = sheet.doc
|
||||||
|
app.msgbox(doc.title)
|
||||||
|
|
||||||
|
|
||||||
Activate
|
Activate
|
||||||
|
@ -367,11 +368,15 @@ Activate
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
||||||
doc = app.active
|
doc = app.active
|
||||||
|
|
||||||
# Get last sheet
|
# Get last sheet
|
||||||
sheet = doc[-1]
|
sheet = doc[-1]
|
||||||
|
|
||||||
# Activate from doc
|
|
||||||
doc.activate(sheet)
|
|
||||||
|
|
||||||
# Activate from sheet
|
# Activate from sheet
|
||||||
sheet.activate()
|
sheet.activate()
|
||||||
|
|
||||||
|
# Activate from doc
|
||||||
|
doc.activate(doc[1])
|
||||||
|
|
||||||
|
# Activate by name
|
||||||
|
doc.activate('Sheet3')
|
||||||
|
|
|
@ -3435,10 +3435,32 @@ class LOCalcSheet(object):
|
||||||
def visible(self, value):
|
def visible(self, value):
|
||||||
self._obj.IsVisible = value
|
self._obj.IsVisible = value
|
||||||
|
|
||||||
|
@property
|
||||||
|
def color(self):
|
||||||
|
return self._obj.TabColor
|
||||||
|
@color.setter
|
||||||
|
def color(self, value):
|
||||||
|
self._obj.TabColor = Color()(value)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def is_protected(self):
|
def is_protected(self):
|
||||||
return self._obj.isProtected()
|
return self._obj.isProtected()
|
||||||
|
|
||||||
|
@property
|
||||||
|
def password(self):
|
||||||
|
return ''
|
||||||
|
@password.setter
|
||||||
|
def password(self, value):
|
||||||
|
self.obj.protect(value)
|
||||||
|
|
||||||
|
def unprotect(self, value):
|
||||||
|
try:
|
||||||
|
self.obj.unprotect(value)
|
||||||
|
return True
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
return False
|
||||||
|
|
||||||
def move(self, pos: int=-1):
|
def move(self, pos: int=-1):
|
||||||
index = pos
|
index = pos
|
||||||
if pos < 0:
|
if pos < 0:
|
||||||
|
@ -3466,6 +3488,10 @@ class LOCalcSheet(object):
|
||||||
sheet = doc.copy_from(self.doc, self.name, new_name, index)
|
sheet = doc.copy_from(self.doc, self.name, new_name, index)
|
||||||
return sheet
|
return sheet
|
||||||
|
|
||||||
|
def activate(self):
|
||||||
|
self.doc.activate(self.obj)
|
||||||
|
return
|
||||||
|
|
||||||
|
|
||||||
class LOCalcRange(object):
|
class LOCalcRange(object):
|
||||||
CELL = 'ScCellObj'
|
CELL = 'ScCellObj'
|
||||||
|
|
Loading…
Reference in New Issue