75 lines
874 B
Markdown
75 lines
874 B
Markdown
|
---
|
||
|
title: Documentos
|
||
|
---
|
||
|
|
||
|
## Trabajar con Documentos
|
||
|
|
||
|
<br>
|
||
|
|
||
|
### **active**
|
||
|
|
||
|
Devuelve el documento activo.
|
||
|
|
||
|
```py
|
||
|
doc = app.active
|
||
|
app.msgbox(doc.title)
|
||
|
```
|
||
|
|
||
|
<br>
|
||
|
|
||
|
### **iteration**
|
||
|
|
||
|
Iterar en todos los documentos abiertos.
|
||
|
|
||
|
```py
|
||
|
for doc in app.docs:
|
||
|
app.debug(doc.type, doc.title)
|
||
|
```
|
||
|
|
||
|
<br>
|
||
|
|
||
|
### **count**
|
||
|
|
||
|
Contar los documentos abiertos.
|
||
|
|
||
|
```py
|
||
|
cuantos = len(app.docs)
|
||
|
app.debug(cuantos)
|
||
|
```
|
||
|
|
||
|
<br>
|
||
|
|
||
|
### **contain**
|
||
|
|
||
|
Verificar si un documento esta en la colección.
|
||
|
|
||
|
```py
|
||
|
resultado = 'mi_archivo.ods' in app.docs
|
||
|
app.debug(resultado)
|
||
|
```
|
||
|
|
||
|
<br>
|
||
|
|
||
|
### **index**
|
||
|
|
||
|
Devolver por índice.
|
||
|
|
||
|
```py
|
||
|
doc = app.docs[1]
|
||
|
app.debug(doc.type, doc.title)
|
||
|
```
|
||
|
|
||
|
<br>
|
||
|
|
||
|
### **name**
|
||
|
|
||
|
Devolver por nombre.
|
||
|
|
||
|
```py
|
||
|
nombre = 'mi_archivo.ods'
|
||
|
if nombre in app.docs:
|
||
|
doc = app.docs[nombre]
|
||
|
app.debug(doc.type, doc.title)
|
||
|
```
|
||
|
|
||
|
<br>
|