Custom table header in big tables

This code creates a sheet with a complex table that takes full advantage of different column and row spans.
uses
  {...}, OExport, OExport_Vcl, OExport_VclForms;

procedure TForm1.BtnTestClick(Sender: TObject);
var
  xExport: TOExport;
  I, L: Integer;
begin
  xExport := TOExport.Create;
  try
    with xExport.AddWorkSheet('Column + Row span') do begin
      AddRow.AddCellString(Title).SetFontSize(20);
      AddRow;

      NewCellStringAlignment := cahCenter;
      NewCellVAlignment := cavCenter;
      NewCellBorders.SetBorders(cbAll, ebThin, clBlack);
      with AddRow do begin
        AddCellString(ExcelRange(0, Rows.Count-1, 1, 4)).SetRowSpan(4);
        AddCellString(ExcelRange(1, Rows.Count-1));
        AddCellString(ExcelRange(2, Rows.Count-1, 2, 1)).SetColSpan(2);
      end;
      with AddRow do begin
        AddCellString;
        AddCellString(ExcelRange(1, Rows.Count-1));
        AddCellString(ExcelRange(2, Rows.Count-1));
        AddCellString(ExcelRange(3, Rows.Count-1, 1, 2)).SetRowSpan(2);
      end;
      with AddRow do begin
        AddCellString;
        AddCellString(ExcelRange(1, Rows.Count-1, 2, 2)).SetColSpan(2).SetRowSpan(2);
      end;
      with AddRow do begin
        AddCellString;
        AddCellString;
        AddCellString;
        AddCellString(ExcelRange(3, Rows.Count-1));
      end;
    end;

    xExport.SaveToFileWithDialog;
  finally
    xExport.Free;
  end;
end;
Categories