We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Adding Borders to a Range of Cells using Aspose.Cells in .NET

I’m looking at the “Adding Borders to a Range of Cells” sample program and when I run it, the resulting range missing a bottom border. I get the same result in my own test code.

Hi Vlad,

Thanks for your posting and using Aspose.Cells.

I have tested this issue with the following sample code using the latest version: Aspose.Cells
for .NET v8.2.2.1
and it worked fine.

I took the code from this documentation article from the section Adding Borders to a Range of Cells

( http://www.aspose.com/docs/display/cellsnet/Adding+Borders+to+Cells )

I have attached the output xls and xlsx files generated by the code and screenshot for your reference.


//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 “D3” cell from the worksheet

Cell cell = worksheet.Cells[“D3”];

//Adding some value to the “D3” cell

cell.PutValue(“Hello World From Aspose”);

//Creating a range of cells starting from “D3” cell to 3rd column in a row

Range range = worksheet.Cells.CreateRange(“D3:F3”);

//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



Thanks for your help. I pulled the latest version available to us (v. and the problem went away.

Hi Vlad,

Thanks for your feedback and using Aspose.Cells.

It is good to know that your issue is resolved with the latest fix. Let us know if you encounter any other issue, we will be glad to look into it and help you further.