Gestionar comentarios en la hoja de cálculo

Trabajando con Comentarios

Añadir Comentarios

Para agregar un comentario a la hoja de cálculo, por favor sigue los siguientes pasos:

  1. Agrega el control Aspose.Cells.GridWeb al Formulario Web.
  2. Accede a la hoja de cálculo a la que estás agregando comentarios.
  3. Agregar un comentario a una celda.
  4. Establece una nota para el nuevo comentario.

Se ha agregado un comentario a la hoja de cálculo

todo:image_alt_text

// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Accessing the reference of the worksheet that is currently active and add a dummy value to cell A1
GridWorksheet sheet = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex];
sheet.Cells["A1"].PutValue("This cell has a comment added, hover to view.");
// Resize first column
sheet.Cells.SetColumnWidth(0, 140);
// Adding comment to "A1" cell of the worksheet
GridComment comment = sheet.Comments[sheet.Comments.Add("A1")];
// Setting the comment note
comment.Note = "These are my comments for the cell";

Acceso a Comentarios

Para acceder a un comentario:

  1. Accede a la celda que contiene el comentario.
  2. Obten la referencia de la celda.
  3. Pasa la referencia a la colección de Comentarios para acceder al comentario.
  4. Ahora es posible modificar las propiedades del comentario.
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Accessing the reference of the worksheet that is currently active
GridWorksheet sheet = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex];
// Accessing a specific cell that contains comment
GridCell cell = sheet.Cells["A1"];
// Accessing the comment from the specific cell
GridComment comment = sheet.Comments[cell.Name];
if (comment != null)
{
// Modifying the comment note
comment.Note = "I have modified the comment note.";
}

Eliminación de Comentarios

Para eliminar un comentario:

  1. Accede a la celda como se explicó anteriormente.
  2. Utilice el método RemoveAt de la colección de comentarios para eliminar el comentario.
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET
// Accessing the reference of the worksheet that is currently active
GridWorksheet sheet = GridWeb1.WorkSheets[GridWeb1.ActiveSheetIndex];
// Accessing a specific cell that contains comment
GridCell cell = sheet.Cells["A1"];
// Removing comment from the specific cell
sheet.Comments.RemoveAt(cell.Name);