Page 1 of 1

SST is NIL while trying to create borders

Posted: Mon Mar 31, 2014 1:31 pm
by DrTob
I try to create borders around some cells with the following code:

Code: Select all

0:    FSheet.AsString[x,y] := ''; //"Create" cell
1:    MakeBorder(FSheet.Cell[x,y]);

procedure TqsmComarisonViewXLSExport.MakeBorder(const ACell: TXLSCell);
begin
2:    ACell.BorderLeftStyle := cbsThin;
3:    ACell.BorderLeftColor := xcGray50;
4:    ACell.BorderBottomStyle := cbsThin;
5:    ACell.BorderBottomColor := xcGray50;
6:    ACell.BorderTopStyle := cbsThin;
7:    ACell.BorderTopColor := xcGray50;
8:    ACell.BorderRightStyle := cbsThin;
9:    ACell.BorderRightColor := xcGray50;
end;
I get an exception at row 8: 'SST String is Nil'. This exception occours always at the fourth/last border. Changing the order does not have any effect.

Re: SST is NIL while trying to create borders

Posted: Tue Apr 01, 2014 5:05 am
by larsa
Hello

When formatting cells, use the CmdFormat object. Please study the FormatCells sample for more details.