开发者

Exception in exporting to excel

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)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜