Hantera kommentarer i kalkylblad
Contents
[
Hide
]
Detta ämne diskuterar tillägg, åtkomst och borttagning av kommentarer från arbetsblad. Kommentarer är användbara för att lägga till anteckningar eller användbar information för användare som kommer att arbeta med arket. Utvecklare har flexibiliteten att lägga till kommentarer till valfri cell i arbetsbladet.
Arbeta med kommentarer
Lägga till kommentarer
För att lägga till en kommentar i arbetsbladet, följ stegen nedan:
- Lägg till kontrollen Aspose.Cells.GridWeb till webbformuläret.
- Gå till det arbetsblad där du ska lägga till kommentarer.
- Lägg till en kommentar i en cell.
- Ange en anteckning för den nya kommentaren.
En kommentar har lagts till i arbetsbladet
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"; |
Åtkomst till kommentarer
För att komma åt en kommentar:
- Gå till den cell som innehåller kommentaren.
- Hämta cellens referens.
- Skicka referensen till kommentarsamlingen för att komma åt kommentaren.
- Det är nu möjligt att ändra kommentarens egenskaper.
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."; | |
} |
Ta bort kommentarer
För att ta bort en kommentar:
- Gå till cellen som förklarats ovan.
- Använd kommentarsamlingens RemoveAt-metod för att ta bort kommentaren.
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); |