unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    NextSheet1: TNextSheet;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    Button4: TButton;
    Button5: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(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. Draw red double line from 1st cell to the last in 2nd row

  for i := 0 to NextSheet1.ColCount - 1 do
  begin
    {$MESSAGE 'Unit NxSheetCell need to be added in uses section to use LineStyle property.'}
    NextSheet1.Cell[i, 1].BorderBottom.LineStyle := lsDouble;
    NextSheet1.Cell[i, 1].BorderBottom.Color := clRed;
  end;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
//  1. Set frame (border) around selected cell

  NextSheet1.FrameCell(NextSheet1.SelectedCol, NextSheet1.SelectedRow, lsSolid, clBlue);
end;

procedure TForm1.Button3Click(Sender: TObject);
begin
  with NextSheet1 do
  begin
    Cell[0, 0].Text := 'lsNone';
    Cell[0, 0].BorderBottom.LineStyle := lsNone;
    Cell[0, 0].BorderBottom.Color := clPurple;

    Cell[0, 1].Text := 'lsThinDot';
    Cell[0, 1].BorderBottom.LineStyle := lsThinDot;
    Cell[0, 1].BorderBottom.Color := clPurple;

    Cell[0, 2].Text := 'lsDot';
    Cell[0, 2].BorderBottom.LineStyle := lsDot;
    Cell[0, 2].BorderBottom.Color := clPurple;

    Cell[0, 3].Text := 'lsDashDotDot';
    Cell[0, 3].BorderBottom.LineStyle := lsDashDotDot;
    Cell[0, 3].BorderBottom.Color := clPurple;

    Cell[0, 4].Text := 'lsDashDot';
    Cell[0, 4].BorderBottom.LineStyle := lsDashDot;
    Cell[0, 4].BorderBottom.Color := clPurple;

    Cell[1, 0].Text := 'lsWideDot';
    Cell[1, 0].BorderBottom.LineStyle := lsWideDot;
    Cell[1, 0].BorderBottom.Color := clPurple;

    Cell[1, 1].Text := 'lsThinLine';
    Cell[1, 1].BorderBottom.LineStyle := lsThinLine;
    Cell[1, 1].BorderBottom.Color := clPurple;

    Cell[1, 2].Text := 'lsWeightDashDotDot';
    Cell[1, 2].BorderBottom.LineStyle := lsWeightDashDotDot;
    Cell[1, 2].BorderBottom.Color := clPurple;

    Cell[1, 3].Text := 'lsSkewDastDot';
    Cell[1, 3].BorderBottom.LineStyle := lsSkewDastDot;
    Cell[1, 3].BorderBottom.Color := clPurple;

    Cell[1, 4].Text := 'lsWeightDashDot';
    Cell[1, 4].BorderBottom.LineStyle := lsWeightDashDot;
    Cell[1, 4].BorderBottom.Color := clPurple;

    Cell[2, 0].Text := 'lsWeightDash';
    Cell[2, 0].BorderBottom.LineStyle := lsWeightDash;
    Cell[2, 0].BorderBottom.Color := clPurple;

    Cell[2, 1].Text := 'lsSolid';
    Cell[2, 1].BorderBottom.LineStyle := lsSolid;
    Cell[2, 1].BorderBottom.Color := clPurple;

    Cell[2, 2].Text := 'lsWeightSolid';
    Cell[2, 2].BorderBottom.LineStyle := lsWeightSolid;
    Cell[2, 2].BorderBottom.Color := clPurple;

    Cell[2, 3].Text := 'lsDouble';
    Cell[2, 3].BorderBottom.LineStyle := lsDouble;
    Cell[2, 3].BorderBottom.Color := clPurple;
  end;
end;

procedure TForm1.Button4Click(Sender: TObject);
begin
//  1. Clear cell colors and borders 
  NextSheet1.ClearFormating(0, 0, NextSheet1.ColCount - 1, NextSheet1.RowCount - 1);
end;

procedure TForm1.Button5Click(Sender: TObject);
begin
//  1. Draw multi-color border

  {$MESSAGE 'Unit NxSheetCell need to be added in uses section to use LineStyle property.'}
  with NextSheet1.Cell[1, 1] do
  begin
    BorderTop.LineStyle := lsThinDot;
    BorderTop.Color := clPurple;

    BorderLeft.LineStyle := lsDouble;
    BorderLeft.Color := clRed;

    BorderBottom.LineStyle := lsWeightDashDotDot;
    BorderBottom.Color := clNavy;

    Color := clCream;
  end;
end;

end.
