Excel Interop - Draw All Borders in a Range

后端 未结 7 1395
春和景丽
春和景丽 2020-12-17 18:29

I see from Microsoft\'s documentation that I can access the particular border edges of a cell using the \'xlBordersIndex\' property and for example set the border style for

7条回答
  •  旧巷少年郎
    2020-12-17 18:57

    Finally, I got it. I did this without impacting the performance too. I am taking a simple excel to explain here :

    Before

    I managed to store the range as A1:C4 in a variable dynamically in exRange and used the below code to give border

    ((Range)excelSheet.get_Range(exRange)).Cells.Borders.LineStyle = XlLineStyle.xlContinuous;
    


    After

提交回复
热议问题