Click here to Skip to main content
11,491,459 members (72,941 online)
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#
in excel mutiple cells to be in border style.

my code as follows;


chartRange = xlWorkSheet.get_Range("A" + xlRow, "A" + xlRow);
                     chartRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, Excel.XlColorIndex.xlColorIndexAutomatic);
                     chartRange = xlWorkSheet.get_Range("B" + xlRow, "B" + xlRow);
                     chartRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, Excel.XlColorIndex.xlColorIndexAutomatic);
                     chartRange = xlWorkSheet.get_Range("C" + xlRow, "C" + xlRow);
                     chartRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, Excel.XlColorIndex.xlColorIndexAutomatic);
                     chartRange = xlWorkSheet.get_Range("D" + xlRow, "D" + xlRow);
                     chartRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, Excel.XlColorIndex.xlColorIndexAutomatic);
                     chartRange = xlWorkSheet.get_Range("E" + xlRow, "E" + xlRow);
                     chartRange.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlMedium, Excel.XlColorIndex.xlColorIndexAutomatic, Excel.XlColorIndex.xlColorIndexAutomatic);
                     xlRow = xlRow + 1;

when i type the above code output as follows;

AFF
Date Session1 Session2 Session3 Session4
14/1/2013 cm rk vk
15//2013 MK Rj GS
16/1/2013 RK CM VK.


from the output the border is coming only for as follows;


14/1/2013 cm rk vk
15//2013 MK Rj GS
16/1/2013 RK CM VK

Border is not coming for as follows;

AFF
Date Session1 Session2 Session3 Session4


i want the border to come for the above two lines.how can i do,help me.

from my above code wat changes are required.
Posted 22-Jan-13 0:01am
Edited 22-Jan-13 0:06am
v2

1 solution

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 521
1 Maciej Los 266
2 Andy Lanng 263
3 Sascha Lefèvre 245
4 OriginalGriff 165
0 Sergey Alexandrovich Kryukov 9,829
1 OriginalGriff 8,520
2 Sascha Lefèvre 3,574
3 Maciej Los 3,151
4 Richard Deeming 2,370


Advertise | Privacy | Mobile
Web03 | 2.8.150520.1 | Last Updated 22 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100