Document Event-Driven Macros

Esta seición describe cómo asignar scripts a eventos de l'aplicación, del documentu o d'un formulariu.

You can automatically execute a macro when a specified software event occurs by assigning the desired macro to the event. The following table provides an overview of document events and at what point an assigned macro is executed.

Eventu

Una macro asignada execútase...

rutina

Aniciar l'aplicación

...after a LibreOffice application is started.

OnStartApp

Close Application

...primero que termine una aplicación de LibreOffice.

OnCloseApp

Document created

...New document created with File - New or with the New icon. Note that this event also fires when Basic IDE opens.

OnCreate

New Document

...dempués de crear un documentu nuevu con Ficheru - Nuevu o col iconu Nuevu.

OnNew

Document loading finished

...before a document is opened with File - Open or with the Open icon.

OnLoadFinished

Abrir documentu

...dempués d'abrir un documentu con Ficheru - Abrir o col iconu Abrir.

OnLoad

Document is going to be closed

...antes de zarrar un documentu.

OnPrepareUnload

Documentu zarráu

...dempués de zarrar un documentu. Tenga en cuenta que l'aición "Guardar documentu" tamién pue activase si'l documentu guarda enantes de zarralu.

OnUnload

-no UI-

OnLayoutFinished

View created

Document is displayed. Note that this event also happens when a document is duplicated.

OnViewCreated

View is going to be closed

Document layout is getting removed.

OnPrepareViewClosing

View closed

Document layout is cleared prior to the document closure.

OnViewClosed

Activar documentu

...dempués de qu'un documentu traer al primer planu.

OnFocus

Desactivar documentu

...dempués de qu'otru documentu traer al primer planu.

OnUnfocus

Guardar documentu

...antes de guardar un documentu con Ficheru - Guardar o l'iconu Guardar, siempres que s'especificara enantes un nome pal documentu.

OnSaveAs

El documentu guardóse

...dempués de guardar un documentu con Ficheru - Guardar o l'iconu Guardar, siempres que s'especificara enantes un nome pal documentu.

OnSaveDone

Saving of document failed

Document could not be saved.

OnSaveFailed

Guardar documentu como

...antes de guardar un documentu con un nome especificáu (con Ficheru - Guardar como o con Ficheru - Guardar o l'iconu Guardar, si nun s'especificó inda un nome de documentu).

OnSaveAs

El documentu guardóse como

... dempués de guardar un documentu con un nome especificáu (con Ficheru - Guardar como o con Ficheru - Guardar o l'iconu Guardar, si nun s'especificó inda un nome de documentu).

OnSaveAsDone

'Save As' has failed

Document could not be saved.

OnSaveAsFailed

-no UI-

When the document disk location has changed, for example after a File - Save As action.

OnStorageChanged

Storing or exporting copy of document

...before a document is saved with File - Save a Copy, File - Export, File - Export as PDF or the Save icons.

OnCopyTo

Document copy has been created

...after a document is saved with File - Save a Copy, File - Export, File - Export as PDF or the Save icons.

OnCopyToDone

Creating of document copy failed

Document could not be copied or exported.

OnCopyToFailed

Print document

...after the Print dialog is closed, but before the actual print process begins. This event occurs for each copy printed.

OnPrint

-no UI-

...after document security settings have changed.

OnModeChanged

'Modified' status was changed

Modified state of a document has changed.

OnModifyChanged

Document title changed

When the document title gets updated.

OnTitleChanged

Loaded a sub component

...after a database form has been opened.

OnSubComponentOpened

Closed a sub component

...after a database form has been closed.

OnSubComponentClosed

Printing of form letters started

...before printing form letters using File - Print or Tools - Mail Merge Wizard menus.

OnMailMerge

Printing of form letters finished

...after printing of form letters using File - Print or Tools - Mail Merge Wizard menus.

OnMailMergeFinished

Printing of form fields started

...before printing form fields.

OnFieldMerge

Printing of form fields finished

...after printing form fields.

OnFieldMergeFinished

Cambéu del númberu de páxines

When the page count changes.

OnPageCountChanged


note

Most events relate to documents, except OnStartApp, OnCloseApp, OnCreate and OnLoadFinished that occur at application level. OnSubComponentOpened, and OnSubComponentClosed events are fired by database's forms.


tip

Writer documents are triggering those specific events: OnLayoutFinished, OnMailMerge, OnMailMergeFinished, OnFieldMerge, OnFieldMergeFinished and OnPageCountChanged.


Asignación d'una macro a una aición

  1. Escueya Ferramientes - Configurar y calque la llingüeta Acciones.

  2. Escueya si desea que l'asignación seya válida globalmente o que namái seya válida nel documentu actual nel cuadru de llista Guardar en.

  3. Escueya aición dende la llista Aición.

  4. Da clic en Macros y escueye la macro a ser asignada al eventu escoyíu.

  5. Da clic en Aceutar p'asignar la macro..

  6. Calque Aceutar pa zarrar el diálogu.

Supresión de l'asignación d'una macro a una aición

  1. Escueya Ferramientes - Configurar y calque la llingüeta Acciones.

  2. Escueya si desea desaniciar una xera global o una xera que namái ye válida nel documentu actual escoyendo la opción nel cuadru de llista Guardar en.

  3. Escueya l'aición que contién l'asignación que deseye suprimir de la llista Acciones.

  4. Calque Desaniciar.

  5. Calque Aceutar pa zarrar el diálogu.

In addition to assigning macros to events, one can monitor events triggered in LibreOffice documents.

Please support us!