excelclosedxml

Style border Excel using ClosedXML in C#


I have a table data in Excel

enter image description here

I want to apply style broder as image enter image description here

How to code script in C# using ClosedXML?


Solution

  • Thank @Francois Botha! I try it and it work. :)

    ws.Range("A1:D4").Style.Border.TopBorder = XLBorderStyleValues.Thin; ws.Range("A1:D4").Style.Border.InsideBorder = XLBorderStyleValues.Dotted; ws.Range("A1:D4").Style.Border.OutsideBorder = XLBorderStyleValues.Thin; ws.Range("A1:D4").Style.Border.LeftBorder = XLBorderStyleValues.Thin; ws.Range("A1:D4").Style.Border.RightBorder = XLBorderStyleValues.Thin; ws.Range("A1:D4").Style.Border.TopBorder = XLBorderStyleValues.Thin;