Thanks for your posting and using Aspose.Cells for .NET.
Please download and use the latest version:
for .NET v220.127.116.11
and see if it resolves your issue.
I have tested your issue with the following sample code using the sample.xlsx file which I have created manually using your given source xlsx file and applied bottom borders to cells F4 till K4 and it has not affected the merged cell’s top border below.
I have also attached the source file and output file as well as screenshot for your reference.
If your issue is still unresolved, please provide us your sample code/project replicating this issue, we will soon look into it and resolve this issue.
string filePath = @“F:\Shak-Data-RW\Downloads\Sample.xlsx”;
Workbook workbook = new Workbook(filePath);
Worksheet worksheet = workbook.Worksheets;
//Apply bottom borders from cell F4 till K4
for (int col = 5; col <= 10; col++)
Cell cell = worksheet.Cells[3, col];
Style style = cell.GetStyle();
style.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Thin;
style.Borders[BorderType.BottomBorder].Color = Color.Red;
Thanks for your posting and using Aspose.Cells.
Your code looks ok to me, however, I am not able to run it at my end and could check it.
There might be some logical errors in your code and because of that your relevant code where you are setting the borders might not be executing.
Could you please provide us your runnable sample project replicating your issue alongwith source xls/xlsx files being used in your code?
It will help us look into your issue precisely and we will be able to help/advise you.