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,
Hi Amjad.
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.