"Center Across Selection"

One cool new feature in Excel is the ability to "Center Across Selection". This means you don't need to merge cells. Is it possible to create an Excel spreadsheet that "Centers Across Selection" using FlexCel?

Thanks,

Steve

Hi,
Yes, this is fully supported, also in preview and when exporting. As usual, APIMate is your friend here.

Just create a file in Excel, center across selection some cells, and open the file in APIMate and it will tell you the code.

I tried it here selecting cells a1 to c1, and this is the code I got:

 //Set the cell values
  fmt := xls.GetCellVisibleFormatDef(1, 1);
  fmt.HAlignment := THFlxAlignment.center_across_selection;
  xls.SetCellFormat(1, 1, xls.AddFormat(fmt));
  xls.SetCellValue(1, 1, 'test');

  fmt := xls.GetCellVisibleFormatDef(1, 2);
  fmt.HAlignment := THFlxAlignment.center_across_selection;
  xls.SetCellFormat(1, 2, xls.AddFormat(fmt));

  fmt := xls.GetCellVisibleFormatDef(1, 3);
  fmt.HAlignment := THFlxAlignment.center_across_selection;
  xls.SetCellFormat(1, 3, xls.AddFormat(fmt));

Brilliant — thanks Adrian!