Bug in range.SetOutlineBorder

Hi,

seems to be I have found a bug :frowning:

Wanted to set a range border orround my data-cells

range = cells.CreateRange(1, 1, 10, 10);
range.SetOutlineBorder(BorderType.RightBorder, CellBorderType.Medium, Color.Red);
range.SetOutlineBorder(BorderType.TopBorder, CellBorderType.Medium, Color.Red);
range.SetOutlineBorder(BorderType.BottomBorder, CellBorderType.Medium, Color.Red);
range.SetOutlineBorder(BorderType.LeftBorder, CellBorderType.Medium, Color.Red);

Now, all cells adjoin the border and have set a backcolor, the backcolor gets automatic to black!

Expect Example:
The Cell A2 has on the left a medium border and some backcolor, it gets NOT the black-backcolor when setting up a medium border orround all data-cells including the cell A2 with the medium border on the left. Maybe the aspose code is checking the border of the current cell and notice that the border is those it should set to and ignores the command!?

Can this bug be removed fast?

Thanks one more time for support, Stefan

Hi Stefan,

Sorry for the bug. Now it’s fixed. Please download fix 1.8.5 and have a try.

Dear Laurence,

it works great, many thanks!

-Stefan

@WebJumper,
Aspose.Cells has replaced the previous product Aspose.Excel which is discontinued now. The new product Aspose.Cells supports vast range of latest features available in different versions of MS Excel. We can set the outline border of range using this new product as shown in the following sample code:

//Instantiate a new Workbook.

Workbook objBook = new Workbook();  

//Get the First sheet.

Worksheet objSheet = objBook.Worksheets["Sheet1"];



//Put some text into different cells (A2, A4, A6, A8).

objSheet.Cells[1, 0].PutValue("Hair Lines");

objSheet.Cells[3, 0].PutValue("Thin Lines");

objSheet.Cells[5, 0].PutValue("Medium Lines");

objSheet.Cells[7, 0].PutValue("Thick Lines");

//Define a range object(A2).

Aspose.Cells.Range _range;

_range = objSheet.Cells.CreateRange("A2", "A2");

//Set the borders with hair lines style.

_range.SetOutlineBorders( CellBorderType.Hair, Color.Black);

//Define a range object(A4).

_range = objSheet.Cells.CreateRange("A4", "A4");

//Set the borders with thin lines style.

_range.SetOutlineBorders(CellBorderType.Thin, Color.Black);

//Define a range object(A6).

_range = objSheet.Cells.CreateRange("A6", "A6");

//Set the borders with medium lines style.

_range.SetOutlineBorders(CellBorderType.Medium, Color.Black);

//Define a range object(A8).

_range = objSheet.Cells.CreateRange("A8", "A8");

//Set the borders with thick lines style.

_range.SetOutlineBorders(CellBorderType.Thick, Color.Black);

//Auto-fit Column A.

objSheet.AutoFitColumn(0);

//Save the excel file.

objBook.Save("f:\\test\\ApplyBorders.xls");     

For more information on formatting a range of cells, visit the following link:
Formatting a Range of Cells

You may download the latest library from the following link:
Aspose.Cells for .NET (Latest Version)

A complete demo project can be downloaded here.