+++ title = "Documentos" weight = 5 +++ #### Trabajar con Documentos ### active Documento activo. ```python doc = app.active app.msgbox(doc.title) ``` ### iteration Iterar en todos los documentos abiertos. ```python for doc in app.docs: app.debug(doc.type, doc.title) ``` ### count Contar los documentos abiertos. ```python cuantos = len(app.docs) app.debug(cuantos) ``` ### contain Verificar si un documento esta en la colección. ```python resultado = 'mi_archivo.ods' in app.docs app.debug(resultado) ``` ### index Devolver por índice. ```python doc = app.docs[1] app.debug(doc.type, doc.title) ``` ### name Devolver por nombre. ```python nombre = 'mi_archivo.ods' if nombre in app.docs: doc = app.docs[nombre] app.debug(doc.type, doc.title) ```