unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls,
  xlsxooxml,  fpstypes, fpspreadsheetgrid;//2020.11.27

type

  { TForm1 }

  TForm1 = class(TForm)
    Button1: TButton;
    sWorksheetGrid1: TsWorksheetGrid;//2020.11.27 fpspreadsheetgrid 패키지 설치하면 사용할수 있는 컨트롤
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private

  public

  end;

var
  Form1: TForm1;
  MyDir : String; //2020.11.27

implementation

{$R *.lfm}

{ TForm1 }

procedure TForm1.FormCreate(Sender: TObject);
begin
  MyDir := ExtractFilePath(ParamStr(0));
end;

procedure TForm1.Button1Click(Sender: TObject);
var
  fmt: TsSpreadsheetFormat;
begin
  ShowMessage(Mydir + 'example1.xlsx');
  fmt:=sfOOXML;
  sWorkSheetGrid1.LoadFromSpreadsheetFile(Mydir + 'example1.xlsx', fmt);
end;

end.

