Free Support Forum - aspose.com

Cell borders

I create 3 spreadsheets using aspose.excel. In each, I loop over cells setting the properties of each one individually. When I use Cell.Borders.SetStyle(CellBorderType.Thin) to turn on cell borders, I can not edit the cell format (Format\Cells… from menu) in Excel. Also, every cell in one of the sheets is crossed out with an X. I have posted the sheet so you can see what is happening.

Which version are you using? have you tried the latest v2.9.7?

Cell.Borders.SetStyle(CellBorderType.Thin) sets all borders, including the diagonal borders. So you can see the crossed X. Please use

cell.Style.Borders[BorderType.LeftBorder].LineStyle = CellBorderType.Thin;
cell.Style.Borders[BorderType.RightBorder].LineStyle = CellBorderType.Thin;


That worked. Thanks very much.

Sorry, spoke too soon. The Xs are gone now. However, when I try to bring up the cell formatting dialog on any cell, nothing happens. If I remove the border code, it comes up fine. Any ideas?

Just want to make sure I get an email this time…

Have you set border color?

cell.Style.Borders[BorderType.LeftBorder].Color = Color.Black;

That was it. Thanks.