wrap and justyfy tect in cell

How to wrap text in a cell?
How to justify text (center) in a cell?
With xls.formatcell ( row, col, ????). But you need to know XF code

Hi,

You get the XF code with AddFormat http://www.tmssoftware.biz/flexcel/doc/vcl/api/FlexCel.Core/TExcelFile/AddFormat.html
See http://www.tmssoftware.biz/flexcel/doc/vcl/guides/api-developer-guide.html#cell-formats 

Now, for all this "how to" questions, the fastest way to find out is always to use APIMate (search for it in the start menu). Create a file in Excel, set the text to wrap and center ir, save the file, and open it with APIMate. It will tell you the code you need to do it in FlexCel.

For this particular case, I get this:


  fmt := xls.GetCellVisibleFormatDef(1, 1);
  fmt.HAlignment := THFlxAlignment.center;
  fmt.WrapText := true;
  xls.SetCellFormat(1, 1, xls.AddFormat(fmt));


You can do a SetCellValue that will both set cell and format by calling
xf := xls.AddFormat(fmt);
xls.SetCellValue(row, col, value, xf);