Compartir vía


Excel.CommentAddedEventArgs interface

Proporciona información sobre los comentarios que generaron el evento de comentario agregado.

Comentarios

[ Conjunto de API: ExcelApi 1.12 ]

Ejemplos

async function registerEventHandler() {
    await Excel.run(async (context) => {
        // Register the onAdded comment event handler.
        const comments = context.workbook.worksheets.getActiveWorksheet().comments;
        comments.onAdded.add(commentAdded);
        await context.sync();
    });
}

async function commentAdded(event: Excel.CommentAddedEventArgs) {
    // Retrieve the added comment using the comment ID.
    // Note: This function assumes only a single comment is added at a time.
    await Excel.run(async (context) => {
        const addedComment = context.workbook.comments.getItem(event.commentDetails[0].commentId);

        // Load the added comment's data.
        addedComment.load(["content", "authorName", "creationDate"]);
        await context.sync();

        // Print out the added comment's data.
        console.log(`A comment was added:`);
        console.log(`    ID: ${event.commentDetails[0].commentId}`);
        console.log(`    Comment content: ${addedComment.content}`);
        console.log(`    Comment author: ${addedComment.authorName}`);
        console.log(`    Creation date: ${addedComment.creationDate}`);
    });
}

Propiedades

commentDetails

Obtiene la CommentDetail matriz que contiene el identificador de comentario y los identificadores de sus respuestas relacionadas.

source

Especifica el origen del evento. Vea Excel.EventSource para más información.

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 se produjo el evento.

Detalles de las propiedades

commentDetails

Obtiene la CommentDetail matriz que contiene el identificador de comentario y los identificadores de sus respuestas relacionadas.

commentDetails: Excel.CommentDetail[];

Valor de propiedad

Comentarios

[ Conjunto de API: ExcelApi 1.12 ]

source

Especifica el origen del evento. Vea Excel.EventSource para más información.

source: Excel.EventSource | "Local" | "Remote";

Valor de propiedad

Excel.EventSource | "Local" | "Remote"

Comentarios

[ Conjunto de API: ExcelApi 1.12 ]

type

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

type: "CommentAdded";

Valor de propiedad

"CommentAdded"

Comentarios

[ Conjunto de API: ExcelApi 1.12 ]

worksheetId

Obtiene el identificador de la hoja de cálculo en la que se produjo el evento.

worksheetId: string;

Valor de propiedad

string

Comentarios

[ Conjunto de API: ExcelApi 1.12 ]