SetOutlineBorder Problem

When I use SetOutlineBorder on a Range object, it does what it should in that it puts the appropriate border within the range. However, it also is adding some random borders within the cells of the range. Is this is a known bug, or am I using it improperly? Here is a sample of my code:



Range thisRange = sheet.Cells.CreateRange(currentRangeUpperLeftCell, currentRangeLowerRightCell);

thisRange.SetOutlineBorder(BorderType.BottomBorder, CellBorderType.Thin, System.Drawing.Color.Black);

thisRange.SetOutlineBorder(BorderType.TopBorder, CellBorderType.Thin, System.Drawing.Color.Black);

thisRange.SetOutlineBorder(BorderType.LeftBorder, CellBorderType.Thin, System.Drawing.Color.Black);

thisRange.SetOutlineBorder(BorderType.RightBorder, CellBorderType.Thin, System.Drawing.Color.Black);



Have you tried the latest hotfix?

If this problem still exists, please send me more of your code and the designer file if you have one.

Laurence -

The latest hotfix fixed the problem. Thanks very much.

@mbuckleman,
Aspose.Excel is discontinued and no more devlopment is done for it. A new advanced product Aspose.Cells has replaced it which contains all the features in Aspose.Excel as well as supports latest features available in different versions of MS Excel.

You can set outline border using this new product as depicted in the following sample code:

// Instantiating a Workbook object
Workbook workbook = new Workbook();

// Obtaining the reference of the first (default) worksheet by passing its sheet index
Worksheet worksheet = workbook.Worksheets[0];

// Accessing the "A1" cell from the worksheet
Cell cell = worksheet.Cells["A1"];

// Adding some value to the "A1" cell
cell.PutValue("Hello World From Aspose");

// Creating a range of cells starting from "A1" cell to 3rd column in a row
Range range = worksheet.Cells.CreateRange(0, 0, 1, 3);

// Adding a thick top border with blue line
range.SetOutlineBorder(BorderType.TopBorder, CellBorderType.Thick, Color.Blue);

// Adding a thick bottom border with blue line
range.SetOutlineBorder(BorderType.BottomBorder, CellBorderType.Thick, Color.Blue);

// Adding a thick left border with blue line
range.SetOutlineBorder(BorderType.LeftBorder, CellBorderType.Thick, Color.Blue);

// Adding a thick right border with blue line
range.SetOutlineBorder(BorderType.RightBorder, CellBorderType.Thick, Color.Blue);

// Saving the Excel file
workbook.Save(dataDir + "book1.out.xls"); 

Here is a detail article where more details and working examples are available for formatting cells:
Cells Formatting

You may download the latest version of this product for trails purpose here:
Aspose.Cells for .NET (Latest Version)

A ready to run solution is available here which can be used to test the product features with minimum effort.