Using c#.net I am exporting data from labels in my fo开发者_运维技巧rm to excel. The code is as follows:
Excel.Font font = range.Font;
font.Color =Color.Black;
While using this code, I am getting an exception
"Methods with System.Color parameters or return type cannot be invoked via IDispatch".
Please help me solve this.
I believe you will find the answer in the following thread: http://social.msdn.microsoft.com/Forums/en-US/vbinterop/thread/6a25be14-fc4f-40c6-aaea-62cb76140cd1/
Quick answer:
font.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Black)
精彩评论