unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, NxScrollControl, NxSheet;

type
  TForm1 = class(TForm)
    NextSheet1: TNextSheet;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

uses
  NxSheetCell;

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  i: Integer;
begin
//  1. Set size of 1st column to be 40px

  NextSheet1.Column[0].Size := 40;

//  2. Merge cells in 1st row and set text

  NextSheet1.MergeCells(0, 0, 3, 0);

//  3. Set merged cell

  { After cells are merged, top-left cell become only active cell }

  NextSheet1.Cell[0, 0].Text := 'Report';
  NextSheet1.Cell[0, 0].Color := clMoneyGreen;
  NextSheet1.Cell[0, 0].BorderBottom.LineStyle := lsThinLine;

//  3.1 Set Cell's font
  with NextSheet1.Cell[0, 0].Font do
  begin
    Name := 'Ariel';
    Size := 12;
    Style := [fsItalic];
  end;

//  3. Fill 1st column with row numbers

  for i := 1 to NextSheet1.RowCount - 1 do
  begin
    {$MESSAGE 'Unit NxSheetCell need to be added in uses section to use Alignment property.'}
    NextSheet1.Cell[0, i].Text := IntToStr(i);
    NextSheet1.Cell[0, i].Alignment := caCenterRight;
    NextSheet1.Cell[0, i].BorderRight.LineStyle := lsThinDot;
  end;
end;

end.
