unit1.pas

来自「delphi的超级好用的表格控件」· PAS 代码 · 共 53 行

PAS
53
字号
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, AdvGridExcel, Grids, BaseGrid, AdvGrid, Buttons,
  ExtCtrls;

type
  TForm1 = class(TForm)
    AdvStringGrid1: TAdvStringGrid;
    AdvGridExcelIO1: TAdvGridExcelIO;
    OpenDialog1: TOpenDialog;
    Panel1: TPanel;
    SpeedButton1: TSpeedButton;
    SpeedButton2: TSpeedButton;
    SaveDialog1: TSaveDialog;
    procedure SpeedButton1Click(Sender: TObject);
    procedure SpeedButton2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
  if opendialog1.Execute  then
  begin
    advgridexcelio1.XLSImport(opendialog1.filename);
  end;
end;

procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
  if savedialog1.execute then
  begin
    if fileexists(savedialog1.filename) then
      deletefile(savedialog1.filename);
    advgridexcelio1.XLSExport(savedialog1.filename);
  end;
end;

end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?