Gestione commenti nel foglio di lavoro
Contents
[
Hide
]
Questo argomento discute l’aggiunta, l’accesso e la rimozione dei commenti dai fogli di lavoro. I commenti sono utili per aggiungere note o informazioni utili per gli utenti che lavoreranno sul foglio. Gli sviluppatori hanno la flessibilità di aggiungere commenti a qualsiasi cella del foglio di lavoro.
Lavorare con i commenti
Aggiunta di commenti
Per aggiungere un commento al foglio di lavoro, seguire i passaggi seguenti:
- Aggiungi il controllo Aspose.Cells.GridWeb al modulo Web.
- Accedi al foglio di lavoro a cui si stanno aggiungendo commenti.
- Aggiungi un commento a una cella.
- Imposta una nota per il nuovo commento.
Un commento è stato aggiunto al foglio di lavoro
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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"; |
Accesso ai commenti
Per accedere a un commento:
- Accedere alla cella che contiene il commento.
- Ottenere il riferimento della cella.
- Passare il riferimento alla raccolta Comment per accedere al commento.
- Ora è possibile modificare le proprietà del commento.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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."; | |
} |
Rimozione dei commenti
Per rimuovere un commento:
- Accedere alla cella come spiegato sopra.
- Utilizzare il metodo RemoveAt della raccolta Comment per rimuovere il commento.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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); |