Contingut

# Objecte ThisComponent

ThisComponent represents the current document in Basic macros. It addresses the active component whose properties can be read and set, and whose methods can be called. Properties and methods available through ThisComponent depend on the document type.

### Sintaxi:

      ThisComponent

When the active window is a Base form, query, report, table or view, ThisComponent returns the current Form information.

When active window is the Basic IDE, ThisComponent object returns the component owning the current script.

### Exemple:

    Sub Main
    ' actualitza la «Taula de continguts» en un document de text
    Dim allindexes, index As Object
        allindexes = ThisComponent.getDocumentIndexes()
        index = allindexes.getByName("Taula de continguts1")
        ' utilitzeu el nom per defecte per a la Taula de continguts i a 1
        index.update()
    End Sub

Temes relacionats

com.sun.star.text.TextDocument API service

com.sun.star.sheet.SpreadsheetDocument API service

com.sun.star.presentation.PresentationDocument API service

com.sun.star.drawing.DrawingDocument API service

Servei de l'API com.sun.star.formula.FormulaProperties

Servei de l'API com.sun.star.sdb.OfficeDatabaseDocument

Servei de l'API com.sun.star.document.OfficeDocument