Exporting an TMSFMXGrid works easy.
But there's a problem when there are "hidden" columns.
An "Argument out of range" error is generatied.
Drop a TMSFMXGrid, TButton and TMSFMXGridExcelIO on a form.
procedure TForm1.FormCreate(Sender: TObject);
var
col: Integer;
begin
TMSFMXGrid1.Options.ColumnSize.Stretch := True;
TMSFMXGrid1.Options.ColumnSize.StretchAll := True;
TMSFMXGrid1.FixedColumns := 0;
TMSFMXGrid1.ColumnCount := 5;
TMSFMXGrid1.RowCount := 5;
for col := 0 to TMSFMXGrid1.ColumnCount - 1 do
begin
TMSFMXGrid1.Cells[col, 0] := 'Col' + IntToStr(col);
TMSFMXGrid1.Cells[col, 1] := 'Finance 1';
TMSFMXGrid1.Cells[col, 2] := 'Finance 2';
TMSFMXGrid1.Cells[col, 3] := 'Research & Development';
TMSFMXGrid1.Cells[col, 4] := 'Finance 3';
end;
TMSFMXGrid1.HideColumn(0); // This causes the problem
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
TMSFMXGridExcelIO1.XLSExport('c:\temp\text.xls');
end;