Free Support Forum - aspose.com

How to set a border around a range of cells

I would like to set a border around a range of cells.

I tried to use

range = cells.CreateRange(1, 1, currentRow - 1, 7)
range.Style = StyleBorder

where styleBorder is defined as
StyleBorder.Borders(BorderType.TopBorder).LineStyle = CellBorderType.Thin
StyleBorder.Borders(BorderType.BottomBorder).LineStyle = CellBorderType.Thin
StyleBorder.Borders(BorderType.LeftBorder).LineStyle = CellBorderType.Thin
StyleBorder.Borders(BorderType.RightBorder).LineStyle = CellBorderType.Thin


The problem is this set the border around each cells and not the range

Is this possible to set the border around a range of cells ?

Daniel

Dear Daniel,

Thanks for your consideration. Currently you have to set the border around a range of cells with your own code.

Laurence

What do you mean by my own code, do you mean I need to set the left, right top, bottom on the range itself

Daniel

Yes, Daniel. You have to seperately set the border type to the cells in the range’s border.

I am thinking about adding a method to the Range object to meet your need. But it’s not easy and currently I am working on other issues of Aspose.Excel.

You have to wait for about 2 months to get this new feature.

Laurence

Do you think this functionality will be available soon ?

Thanks - Daniel

Dear Daniel,

It will be available in the mid of next month.

Dear Daniel,

This feature is available. Please download the newest hotfix 1.7.1.

Dear Daniel,

This feature is available. Please download the newest hotfix 1.7.1.

Please use the Range.SetOutlineBorder method.