I will paste the code segment here again for your reference, I used your template file you attached in your other thread here.
Workbook workbook = new Workbook(“e:\test2\aspose+cells+pls+help.xls”);
Worksheet worksheet = workbook.Worksheets[0];
Cells cells = worksheet.Cells;
//Set the Top and Bottom border styles with alignment setting
Style stotal = workbook.Styles[workbook.Styles.Add()];
stotal.Number = 4;
stotal.HorizontalAlignment = TextAlignmentType.Right;
stotal.Borders[BorderType.TopBorder].LineStyle = CellBorderType.Thick;
stotal.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Thick;
StyleFlag flag1;
flag1 = new StyleFlag();
flag1.NumberFormat = true;
flag1.Borders = true;
flag1.HorizontalAlignment = true;
//Find the Subtotal cell to get the row indexes.
int row1=0, row2=0;
FindOptions options = new FindOptions();
options.CaseSensitive = true;
options.LookAtType = LookAtType.EntireContent;
options.LookInType = LookInType.Values;
Cell foundCell = cells.Find(“2014 Total”, null, options);
if (foundCell != null)
{
row1 = foundCell.Row;
}
foundCell = cells.Find(“Grand Total”, null, options);
if (foundCell != null)
{
row2 = foundCell.Row;
}
//Now apply the top and bottom borders with number formattings and alignment to both entire rows.
cells.ApplyRowStyle(row1, stotal, flag1);
cells.ApplyRowStyle(row2, stotal, flag1);
workbook.Save(“e:\test2\topbottomborders2.xlsx”);