How to set cell alignment

Can you tell me how to set cell alignment (left/right/centre) using FlexCel. I cant seem to find a function or procedure to do this.

In OLE, I can use something like

WorkSheet.Cells[R,C].HorizontalAlignment:=Align;



(where Align is 1 for default, 2 for left, 3 for centre, 4 for right)


Hi,

Use code like this:

var
  fmt: TFlxFormat;
...
begin
  fmt := xls.GetFormat(xls.GetCellFormat(R, C));  fmt.HAlignment := THFlxAlignment.right;  xls.SetCellFormat(R, C, xls.AddFormat(fmt));




And remember that you can always use APIMate for this kind of stuff. Just create a file in Excel, change the alignment, and open the file in APIMate. It will tell you the code needed to change the alignment.


Thank you. Worked perfectly!