C# C语言中的Excel工作表注释#

C# C语言中的Excel工作表注释#,c#,excel,aspose-cells,C#,Excel,Aspose Cells,我有一个从SQL中筛选出来的列表和一个储存它们的excel表格。在那个列表中,我有一列名为a。 如果该列存在,则应在该列的标题处显示注释。 它的位置可能会改变,因此我不能使用此选项: int commentIndex = worksheet.Comments.Add("F5"); Comment comment = worksheet.Comments[commentIndex]; comment.Note = "Hello Aspose!"; 这是我的专栏 if (dt.Columns[i]

我有一个从SQL中筛选出来的列表和一个储存它们的excel表格。在那个列表中,我有一列名为a。 如果该列存在,则应在该列的标题处显示注释。 它的位置可能会改变,因此我不能使用此选项:

int commentIndex = worksheet.Comments.Add("F5");
Comment comment = worksheet.Comments[commentIndex];
comment.Note = "Hello Aspose!";
这是我的专栏

if (dt.Columns[i].ColumnName==A)
{
    // code to be filled
}

dt=包含SQL列的数据表。

我这样做并解决了问题:

int commentIndex = ws.Comments.Add(0, i);
    Aspose.Cells.Comment comment = ws.Comments[commentIndex];
comment.Note = "Blalala";