0
什麼是在Excel中使用C#插入圖像評論到單元格的最佳方式?添加圖像評論到excel單元格
我正在使用Microsoft.Office.Interop.Excel。
到目前爲止,我已經做了
Microsoft.Office.Interop.Excel.Application excel = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel.Workbook wb = excel.Workbooks.Open(filename);
Microsoft.Office.Interop.Excel.Worksheet sheet = wb.Sheets[1];
var commnetImage = sheet.Shapes.AddPicture(@"d:\download.jpg", Microsoft.Office.Core.MsoTriState.msoTrue, Microsoft.Office.Core.MsoTriState.msoFalse,
0, 0, 100, 200);
var gg = sheet.Cells.Range["E5"];
gg.ClearComments();
gg.AddComment(commnetImage);
wb.Save();
excel.Quit();
你看過[Epplus圖書館](http://epplus.codeplex.com/)的替代使用Interops? Interop通常非常緩慢且不可靠。在繼續您的項目之前,我會建議看一看。這是一個非常簡單的使用庫。我已經寫了一些示例代碼來開始幾年前的一個視圖。看看[我的博客](http://www.jasonsmith.co.za/2011/03/readingwriting-xlsx-files.html) –
Jus現在看着它,我看到了對單元格示例的添加註釋,它支持圖像? – user3316165