【发布时间】:2015-06-27 09:01:32
【问题描述】:
在 EPPlus 中,我可以使用 workSheet.Cells[x, y].AddComment() 将 cmets 添加到工作表中的单元格
但是如何从给定单元格中删除评论 - 没有 workSheet.Cells[i, j].RemoveComment() - 我需要保留任何其他 cmets
提前感谢您的任何建议
【问题讨论】:
标签: epplus
在 EPPlus 中,我可以使用 workSheet.Cells[x, y].AddComment() 将 cmets 添加到工作表中的单元格
但是如何从给定单元格中删除评论 - 没有 workSheet.Cells[i, j].RemoveComment() - 我需要保留任何其他 cmets
提前感谢您的任何建议
【问题讨论】:
标签: epplus
人们会认为它会那么简单:)。
看看这个:
[TestMethod]
public void Comment_Test()
{
var existingFile = new FileInfo(@"c:\temp\temp.xlsx");
if (existingFile.Exists)
existingFile.Delete();
using (var package2 = new ExcelPackage(existingFile))
{
var ws = package2.Workbook.Worksheets.Add("Sheet1");
ws.Cells[1, 1].AddComment("Comment Test 1", "Me");
ws.Cells[1, 2].AddComment("Comment Test 2", "Me");
ws.Cells[1, 3].AddComment("Comment Test 3", "Me");
//Alternate way to add a comment
ws.Comments.Add(ws.Cells[1, 4], "Comment Test 4", "Me");
//Remove middle comment
ws.Comments.Remove(ws.Cells[1,2].Comment);
package2.Save();
}
}
【讨论】: