开发者

Exception in exporting to excel

开发者 https://www.devze.com 2023-04-01 18:19 出处:网络
Using c#.net I am exporting data from labels in my fo开发者_运维技巧rm to excel. The code is as follows:

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

精彩评论

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