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

Free Support Forum - aspose.com

Loosing border on merge

I am creating an excel spreadsheet and then converting it to HTML.

On the HTML side I would like to show the grid lines.
I accomplish this by:
style.Borders[BorderType.TopBorder].LineStyle = CellBorderType.Thin;
style.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Thin;
style.Borders[BorderType.LeftBorder].LineStyle = CellBorderType.Thin;
style.Borders[BorderType.RightBorder].LineStyle = CellBorderType.Thin;

This works for the most part. The issue I am seeing is that I am loosing the BottomBorder setting on the last row if I am merging cells. This works perfect on un-merged cells.

Any ideas on how to resolve this?


Thanks for the screen shot and some details.

Please try our latest version/ fix: Aspose.Cells for .NET v8.6.1.1

I have evaluated your scenario/ case a bit. I used a simple template file (attached) with the following sample code, it works fine. I generated both XLSX and HTML files, both are fine. I have attached the output HTML file in the attached archive for your reference:
Sample code:

Workbook workbook = new Workbook(“e:\test2\Bkbordermerge.xlsx”);

Worksheet worksheet = workbook.Worksheets[0];

//Formatting cells and ranges.
//Creating a range that spans over the all data cells of a worksheet
var range = worksheet.Cells.CreateRange(“B3”, “E6”);
//Create a Style object.
Style colstyle = workbook.CreateStyle();
colstyle.Borders[BorderType.LeftBorder].LineStyle = CellBorderType.Thin;
colstyle.Borders[BorderType.RightBorder].LineStyle = CellBorderType.Thin;
colstyle.Borders[BorderType.TopBorder].LineStyle = CellBorderType.Thin;
colstyle.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Thin;
colstyle.HorizontalAlignment = TextAlignmentType.Center;
StyleFlag flag = new StyleFlag();
flag.Borders = true;
//Apply the style to the range
range.ApplyStyle(colstyle, flag);

workbook.Save(“e:\test2\output1_mergedbordercells.html”, SaveFormat.Html);

If you still find the issue with v8.6.1.1, I am afraid, we need a simple console application (runnable) with your template file(s) (if there is any) to reproduce the issue on our end. We will check it soon.

Thank you.