Compartir vía


Excel.WorksheetSelectionChangedEventArgs interface

Proporciona información sobre la hoja de cálculo que generó el evento de cambio de selección.

Comentarios

[ Conjunto de API: ExcelApi 1.7 ]

Ejemplos

async function registerEventHandlers() {
      await Excel.run(async (context) => {
        // Add a selection changed event handler for the worksheet.
        let sheet = context.workbook.worksheets.getItem("Sample");
        sheet.onSelectionChanged.add(onWorksheetSelectionChange);

        // Add a selection changed event handler for the worksheet collection.
        context.workbook.worksheets.onSelectionChanged.add(onWorksheetCollectionSelectionChange);

        await context.sync();
      });
    }

    async function onWorksheetSelectionChange(args: Excel.WorksheetSelectionChangedEventArgs) {
      await Excel.run(async (context) => {
        console.log(`Worksheet event: The address of new selection is: ${args.address}`);
      });
    }

    async function onWorksheetCollectionSelectionChange(args: Excel.WorksheetSelectionChangedEventArgs) {
      await Excel.run(async (context) => {
        console.log(`WorksheetCollection event: The address of new selection is: ${args.address}`);
      });
    }

Propiedades

address

Obtiene la dirección del intervalo que representa el área seleccionada de una hoja de cálculo específica.

type

Obtiene el tipo del evento. Vea Excel.EventType para más información.

worksheetId

Obtiene el identificador de la hoja de cálculo en la que cambió la selección.

Detalles de las propiedades

address

Obtiene la dirección del intervalo que representa el área seleccionada de una hoja de cálculo específica.

address: string;

Valor de propiedad

string

Comentarios

[ Conjunto de API: ExcelApi 1.7 ]

type

Obtiene el tipo del evento. Vea Excel.EventType para más información.

type: "WorksheetSelectionChanged";

Valor de propiedad

"WorksheetSelectionChanged"

Comentarios

[ Conjunto de API: ExcelApi 1.7 ]

worksheetId

Obtiene el identificador de la hoja de cálculo en la que cambió la selección.

worksheetId: string;

Valor de propiedad

string

Comentarios

[ Conjunto de API: ExcelApi 1.7 ]