Skip to content

Instantly share code, notes, and snippets.

@TPAKC
Created June 8, 2017 05:49
Show Gist options
  • Save TPAKC/41317f35e82fa8464cd942d6a4197b6d to your computer and use it in GitHub Desktop.
Save TPAKC/41317f35e82fa8464cd942d6a4197b6d to your computer and use it in GitHub Desktop.
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, jpeg, ComObj, Grids;
type
TForm2 = class(TForm)
Image1: TImage;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
Button1: TButton;
StringGrid1: TStringGrid;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.Button1Click(Sender: TObject);
var Excel: variant; i, j: word;
begin
Excel := CreateOleObject('Excel.Application');
if OpenDialog1.Execute then
Excel.Workbooks.Open(OpenDialog1.FileName);
for i := 10 to 25 do
for j := 1 to 10 do
StringGrid1.Cells[j, i-10] := Excel.Sheets[1].Cells[i, j].Text;
end;
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment