Skip to main content

Would like to see a method to create inside borders like Excel does - Community / GemBox.Spreadsheet Feature Request - GemBox Support Center

I tried to use the horizontal and vertical border lines when creating border lines but it was not successful when selecting a rage of cells. Applying lines as vertical and horizontal didn't seem to have any affect to either as one might expect on inside borders when selecting a range. The work around it seems is to select each cell and apply a outline to them all singularly. That causes a performance drop if there are a lot of cells.  Does anyone else know how to apply borders to inside cells within a range or does everyone handle it when the write a value to a cell regardless if it has any value or not?

Comments (2)

Rob Sherratt
Isn't this a "bug fix request" ?... because "SetBorders" in some cases applies borders to the outside of the CellRange area, and in other cases such as "MultipleBorders.All" it sets some borders such as diagonals on a cell by cell basis inside the CellRange area, but does not ever set the internal vertical and horizontal borders for each cell. This behaviour is inconsistent with how borders are specified and applied to a cell range in Excel.

Private Sub SetCellBorders(range As CellRange, color As SpreadsheetColor, lineStyle As LineStyle)
range.Style.Borders.SetBorders(MultipleBorders.All, color, lineStyle)
End Sub
Mario - GemBox

Currently there is no enum for inside borders so this is essentially a feature request for that enum.
Also please see the MultipleBorders enum's help page:
Notice that it's a flag enum and a corresponding values for each of them are provided on that link.

For example the "Horizontal" (value of 3) is equal to "Top" and "Bottom" (value of 1 and 2).


GemBox d.o.o.