2016-11-07 75 views
1

我有一個從SQL中過濾的列表以及存儲它們的Excel工作表。在該列表中,我有一個名爲A的列。 如果該列存在,則該列的標題應該出現註釋。 它的位置可能會改變,所以我不能使用這樣的:C#中的Excel工作表註釋#

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 
} 

有從SQL列DT =數據表。

回答

1

這裏是我做到了,解決了這個問題:

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