Kommentare in Arbeitsblatt verwalten
Contents
[
Hide
]
Dieses Thema behandelt das Hinzufügen, Zugreifen und Entfernen von Kommentaren aus Arbeitsblättern. Kommentare sind nützlich, um Notizen oder nützliche Informationen für Benutzer hinzuzufügen, die mit dem Blatt arbeiten werden. Entwickler haben die Flexibilität, Kommentare zu jeder Zelle des Arbeitsblatts hinzuzufügen.
Arbeiten mit Kommentaren
Kommentare hinzufügen
Um einem Arbeitsblatt einen Kommentar hinzuzufügen, befolgen Sie bitte die folgenden Schritte:
- Fügen Sie das Aspose.Cells.GridWeb-Control dem Webformular hinzu.
- Greifen Sie auf das Arbeitsblatt zu, zu dem Sie Kommentare hinzufügen.
- Fügen Sie einem Zelle einen Kommentar hinzu.
- Setzen Sie eine Notiz für den neuen Kommentar.
Ein Kommentar wurde dem Arbeitsblatt hinzugefügt
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"; |
Zugriff auf Kommentare
Um auf einen Kommentar zuzugreifen:
- Greifen Sie auf die Zelle zu, die den Kommentar enthält.
- Ermitteln Sie die Referenz der Zelle.
- Geben Sie die Referenz an die Kommentar-Sammlung weiter, um auf den Kommentar zuzugreifen.
- Es ist jetzt möglich, die Eigenschaften des Kommentars zu ändern.
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."; | |
} |
Kommentare entfernen
Um einen Kommentar zu entfernen:
- Greifen Sie wie oben erläutert auf die Zelle zu.
- Verwenden Sie die RemoveAt-Methode der Kommentar-Sammlung, um den Kommentar zu entfernen.
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); |