您的位置:首页 > 其它

Some Useful code for Excel comment

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

Insert a pitcture to excel

1pics.Insert(page.Server.MapPath("../../Images/stop.bmp"),Type.Missing);
2 Excel.Range range = oWorkSheet.get_Range("D"+EndIndex,"D"+EndIndex);
3 Excel.Picture pics01 = (Excel.Picture)pics.Item(1);
4 pics01.Top = (double)range.Top;
5 pics01.Left = (double)range.Left;
6 pics01.ShapeRange.PictureFormat.TransparentBackground = Microsoft.Office.Core.MsoTriState.msoTrue;
7 pics01.ShapeRange.PictureFormat.TransparencyColor = 0;
8 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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: