Click here to Skip to main content
14,880,690 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
this is my code for set the border for each row.

Excel.Range BorderRAnge;
BorderRAnge = xlsheet.get_Range("A","E");
BorderRAnge.Font.Bold = true;
BorderRAnge.BorderAround(Excel.XlLineStyle.xlContinuous,       Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, Excel.XlColorIndex.xlColorIndexAutomatic);

when i run error shows as follows;
Cannot implicitly convert type 'Microsoft.Office.Interop.Excel.Range' to 'Excel.Range'. An explicit conversion exists (are you missing a cast?)

the above error shows in BorderRAnge = xlsheet.get_Range("A","E"); (this line).

please help me. what is the mistake in my code. i tried but it is not working.
Updated 14-Jun-20 6:42am
CHill60 5-Feb-13 5:15am
what's your declaration of "Excel" and "xlsheet"?
Zoltán Zörgő 5-Feb-13 5:46am
Repost on:
What is with that one? Don't you think it is rude not reacting to the answers?

1 solution

try to set border individually like below

hope this helps

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900