Anda di halaman 1dari 7

BAB IV

HASIL
Kode Program
a. Memakai Komponen begin
WebBrowser Close;
unit untWebBrowser; end;

interface procedure
TfrmWebBrowser.Button1Clic
uses k(Sender: TObject);
Windows, Messages, begin
SysUtils, Variants, Classes, if OpenDialog1.Execute then
Graphics, Controls, Forms, Begin
Dialogs, OleCtrls, txtNamaFile.Text :=
SHDocVw, StdCtrls; OpenDialog1.FileName;

type WebBrowser1.Navigate(Open
TfrmWebBrowser = Dialog1.FileName);
class(TForm) End;
Label1: TLabel; end;
txtNamaFile: TEdit;
Button1: TButton; end.
OpenDialog1: b. Memakai Tag HTML
TOpenDialog;
WebBrowser1: unit untTagHTML;
TWebBrowser;
Button2: TButton; interface
procedure
Button2Click(Sender: uses
TObject); Windows, Messages,
procedure SysUtils, Variants, Classes,
Button1Click(Sender: Graphics, Controls, Forms,
TObject); Dialogs, HTTPApp,
private HTTPProd, StdCtrls;
{ Private declarations }
public type
{ Public declarations } TfrmTagHTML =
end; class(TForm)
Button1: TButton;
var Button2: TButton;
frmWebBrowser: PageProducer1:
TfrmWebBrowser; TPageProducer;
Memo1: TMemo;
implementation procedure
Button2Click(Sender:
{$R *.dfm} TObject);
procedure
procedure Button1Click(Sender:
TfrmWebBrowser.Button2Clic TObject);
k(Sender: TObject);
procedure Dialogs, StdCtrls, HTTPApp,
FormCreate(Sender: TObject); HTTPProd, OleCtrls,
private SHDocVw;
{ Private declarations }
public type
{ Public declarations } TfrmWebPageProc =
end; class(TForm)
Button1: TButton;
var Button2: TButton;
frmTagHTML: WebBrowser1:
TfrmTagHTML; TWebBrowser;
SaveDialog1: TSaveDialog;
implementation PageProducer1:
TPageProducer;
{$R *.dfm} procedure
Button2Click(Sender:
procedure TObject);
TfrmTagHTML.Button2Click( procedure
Sender: TObject); Button1Click(Sender:
begin TObject);
Close; private
end; { Private declarations }
public
procedure { Public declarations }
TfrmTagHTML.Button1Click( end;
Sender: TObject);
begin var
Memo1.Text := frmWebPageProc:
PageProducer1.Content; TfrmWebPageProc;
end;
implementation
procedure
TfrmTagHTML.FormCreate(S {$R *.dfm}
ender: TObject);
begin procedure
TfrmWebPageProc.Button2Cli
end; ck(Sender: TObject);
begin
end. Close;
end;
c. Menggabungkan
PageProducer Dengan procedure
WebBrowser TfrmWebPageProc.Button1Cli
unit untWebPageProducer; ck(Sender: TObject);
Var
interface NamaFile : string;
OutFile : TextFile;
uses begin
Windows, Messages, if SaveDialog1.Execute then
SysUtils, Variants, Classes, begin
Graphics, Controls, Forms, NamaFile :=
SaveDialog1.FileName;
AssignFile(OutFile, var ReplaceText: String);
NamaFile); procedure
rewrite(OutFile); Table1AfterScroll(DataSet:
TDataSet);
write(OutFile,PageProducer1. procedure
Content); FormActivate(Sender:
CloseFile(OutFile); TObject);
procedure
WebBRowser1.Navigate(Nam FormClose(Sender: TObject;
aFile); var Action: TCloseAction);
end; private
{ Private declarations }
end; public
{ Public declarations }
end. end;
d. Menampilkan Data Dari var
Tabel frmDataTable:
unit untDataTable; TfrmDataTable;

interface implementation

uses {$R *.dfm}


Windows, Messages,
SysUtils, Variants, Classes, procedure
Graphics, Controls, Forms, TfrmDataTable.Button1Click(
Dialogs, StdCtrls, HTTPApp, Sender: TObject);
HTTPProd, DSProd, ExtCtrls, begin
DBCtrls, DB, Close;
DBTables, OleCtrls, end;
SHDocVw;
procedure
type TfrmDataTable.DataSetPagePr
TfrmDataTable = oducer1HTMLTag(Sender:
class(TForm) TObject;
WebBrowser1: Tag: TTag; const TagString:
TWebBrowser; String; TagParams: TStrings;
Table1: TTable; var ReplaceText: String);
DataSource1: TDataSource; begin
DBNavigator1: if TagString = 'tgl' then
TDBNavigator; ReplaceText :=
DataSetPageProducer1: DateToStr(now);
TDataSetPageProducer; end;
Button1: TButton;
procedure procedure
Button1Click(Sender: TfrmDataTable.Table1AfterSc
TObject); roll(DataSet: TDataSet);
procedure Const
DataSetPageProducer1HTML NamaFile =
Tag(Sender: TObject; Tag: 'D:\PraktikumAPK\Acara7\Dt
TTag; Alsin.html';
const TagString: String; Var
TagParams: TStrings; OutFile : TextFile;
begin procedure
AssignFile(OutFile, Button2Click(Sender:
NamaFile); TObject);
Rewrite(OutFile); procedure
Write(OutFile, Button1Click(Sender:
DataSetPageProducer1.Conten TObject);
t); procedure
CloseFile(OutFile); FormActivate(Sender:
TObject);
WebBrowser1.Navigate(Nama procedure
File); FormClose(Sender: TObject;
end; var Action: TCloseAction);
private
procedure { Private declarations }
TfrmDataTable.FormActivate( public
Sender: TObject); { Public declarations }
begin end;
Table1.Open;
end; var
frmHTMLTable:
procedure TfrmHTMLTable;
TfrmDataTable.FormClose(Se
nder: TObject; implementation
var Action: TCloseAction);
begin {$R *.dfm}
Table1.Close;
end; procedure
TfrmHTMLTable.Button2Clic
end. k(Sender: TObject);
begin
e. Membuat Tabel HTML Close;
unit untTableHTML; end;

interface procedure
TfrmHTMLTable.Button1Clic
uses k(Sender: TObject);
Windows, Messages, Const
SysUtils, Variants, Classes, NamaFile =
Graphics, Controls, Forms, 'D:\PraktikumAPK\Acara7\Dt
Dialogs, StdCtrls, HTTPApp, Alsin2.html';
DBWeb, OleCtrls, SHDocVw, Var
DB, DBTables, HTTPProd; OutFile : TextFile;
begin
type Table1.First;
TfrmHTMLTable = AssignFile(OutFile,
class(TForm) NamaFile);
Table1: TTable; Rewrite(OutFile);
WebBrowser1: Write(OutFile,
TWebBrowser; DataSetTableProducer1.Conte
DataSetTableProducer1: nt);
TDataSetTableProducer; CloseFile(OutFile);
Button1: TButton;
Button2: TButton;
WebBrowser1.Navigate(Nama procedure
File); TfrmHTMLTable.FormClose(
end; Sender: TObject;
var Action: TCloseAction);
procedure begin
TfrmHTMLTable.FormActivat Table1.Close;
e(Sender: TObject); end;
begin
Table1.Open; end.
end;

B. Hasil Running
a. Memakai Komponen WebBrowser
b. Memakai Tag HTML

Menggabungkan PageProducer Dengan WebBrowser


c. Menampilkan Data Dari Tabel

d. Membuat Tabel HTML