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

Free Support Forum - aspose.com

Remove border outline

if i want to remove border outline, how can i archive this? Below code not work

rng.SetOutlineBorder(BorderType.BottomBorder,CellBorderType.None, Color.Empty)

Hi,


Well, you may try to remove all the borders (top, bottom, left, right) to none:
e.g
Sample code:


rng.SetOutlineBorder(BorderType.TopBorder, CellBorderType.None, Color.Empty);
rng.SetOutlineBorder(BorderType.BottomBorder, CellBorderType.None, Color.Empty);
rng.SetOutlineBorder(BorderType.LeftBorder, CellBorderType.None, Color.Empty);
rng.SetOutlineBorder(BorderType.RightBorder, CellBorderType.None, Color.Empty);

Let us know if you still find any issue.

Thank you.

Hi Amjad.


Thanks for replying.
I do not think that the solution worked. I am attaching a excel template. You can see the cells E11, G11, J11, K11, D14. I want to remove the black bottom border. When I try to remove the bottom border in excel only a new thick line appears (which I think is outline or it might be some other thing). I have the requirement that the cells mentioned above should be same as cell E15 with no bottom border and no outline. The problem is I am not able to understand what thick lines comes even after removing the border bottom .

Can you help ??
Hi Ankit,

Thanks for the template file and details.

We did evaluate your issue in details using your template file and found the cause of this issue. But, I am afraid there is no simple way for you to get the expected results in your template file. We think your file might be generated by some other tool other than MS Excel. In fact, there is no bottom border set for the style of the cell, e.g E11. The border was set on the style of E12 for its top border. For performance consideration when using Aspose.Cells component to set styles, there is no guarantee that all adjacent borders will be kept consistent for all adjacent cells. We think, for this kind of situation, you should remove the top border for E12 cell (next cell in that column) too (on a safer side) when removing the bottom border for E11 cell. Please do the same for other cells on which you want to remove bottom borders. See the sample code that works fine for your reference:
e.g
Sample code:

//Open an Excel file.

Workbook workbook = new Workbook("Apple+(3).xlsx");

Worksheet worksheet = workbook.getWorksheets().get(0);

Cells cells = worksheet.getCells();

Cell cell = cells.get("E11");

Style style = cell.getStyle();

style.setBorder(BorderType.BOTTOM_BORDER, CellBorderType.NONE, Color.getEmpty());

// Saving the modified style to the E11 cell with removed bottom border (it it has)

cell.setStyle(style);

//Get the cell after E11 in the column, i.e., E12 cell.

cell = cells.get("E12");

style = cell.getStyle();

// Saving the modified style to the "E12" cell with removed top border.

style.setBorder(BorderType.TOP_BORDER, CellBorderType.NONE, Color.getEmpty());

cell.setStyle(style);

// Saving the Excel file

workbook.save("out1.xlsx");

Hope, this helps a bit.

Thank you.