1Some Useful code for Excel commentExcel.Range  range =  oWorkSheet.get_Range("A1",missing);
 2Some Useful code for Excel comment        
 3Some Useful code for Excel comment            Excel.Comment comment = range.AddComment("");
 4Some Useful code for Excel comment
 5Some Useful code for Excel comment            comment.Shape.Fill.UserPicture(@"d:\\stop.jpg");                                                      //insert the picture 
 6Some Useful code for Excel comment            comment.Shape.Shadow.Visible = Microsoft.Office.Core.MsoTriState.msoFalse;  //set the shadow don't display
 7Some Useful code for Excel comment            comment.Shape.ThreeD.Visible = Microsoft.Office.Core.MsoTriState.msoFalse;   //set the ThreeD effect don't display
 8Some Useful code for Excel comment            comment.Shape.Line.Visible =  Microsoft.Office.Core.MsoTriState.msoFalse;       //set the line hidden
 9Some Useful code for Excel comment            comment.Shape.IncrementLeft((float)-0.75);                                                                  //set the comment shape position
10Some Useful code for Excel comment            comment.Shape.IncrementTop((float)8.25);
11Some Useful code for Excel comment            comment.Text("  ",missing,missing) ;                                                                             //repalce the comment text
12Some Useful code for Excel comment            comment.Visible = true;


Insert a pitcture to excel

1Some Useful code for Excel commentpics.Insert(page.Server.MapPath("../../Images/stop.bmp"),Type.Missing);
2Some Useful code for Excel comment            Excel.Range range =  oWorkSheet.get_Range("D"+EndIndex,"D"+EndIndex);
3Some Useful code for Excel comment            Excel.Picture pics01 = (Excel.Picture)pics.Item(1);
4Some Useful code for Excel comment            pics01.Top = (double)range.Top;
5Some Useful code for Excel comment            pics01.Left = (double)range.Left;
6Some Useful code for Excel comment            pics01.ShapeRange.PictureFormat.TransparentBackground = Microsoft.Office.Core.MsoTriState.msoTrue;
7Some Useful code for Excel comment            pics01.ShapeRange.PictureFormat.TransparencyColor = 0;
8Some Useful code for Excel comment            pics01.ShapeRange.Fill.Visible = Microsoft.Office.Core.MsoTriState.msoFalse;

From:  http://www.codeproject.com/office/office_automation.asp?df=100&forumid=356843&exp=0&select=1815109

相关文章: