線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:2071
推到 Plurk!
推到 Facebook!

請問有人知道這個程式的每句的動作是做什麼的嗎?

 
mayday741130
一般會員


發表:11
回覆:8
積分:3
註冊:2006-07-22

發送簡訊給我
#1 引用回覆 回覆 發表時間:2006-07-23 16:13:09 IP:220.140.xxx.xxx 未訂閱

procedure TForm1.Button1Click(Sender: TObject);
var
FileName : String;
begin
FileName := edit1.text;
glopen(_file_,FileName);
LINE := 3;
try
MyPDF := TPDFDocument.Create(nil);
try
MyPDF.FileName := edit1.text '.pdf';
MyPDF.DocumentInfo.Title := 'telefoonnummers';
if Launch.Checked then
MyPDF.Autolaunch:= NOT MyPDF.AutoLaunch;

MyPDF.Compression := ctFlate;
MyPDF.BeginDoc;
while NOT EOF(_file_) do
begin
with MyPDF.CurrentPage do
begin
BeginText;
SetActiveFont('Arial', [], 8, CHINESEBIG5_CHARSET);
ReadLN( _file_, _string_ );
TextOut(20, (10*line) , 0, _string_);
INC(line);
if line mod 79 = 0 then
begin
line := 1;
SetActiveFont('Arial', [], 10, CHINESEBIG5_CHARSET);
if page_nr.checked then
TextOut(280, 800 , 0, 'page ' IntToStr(Mypdf.PageCount));
Mypdf.Newpage;
end;
EndText;
end;
end;
try
MyPDF.EndDoc;
except
on Exception do
begin
MyPDF.Abort;
raise;
end;
end;
finally
MyPDF.Free;
end;
except
on E: Exception do
Writeln(E.message);
end;

------
小LO
cschen99
一般會員


發表:3
回覆:6
積分:6
註冊:2005-08-30

發送簡訊給我
#2 引用回覆 回覆 發表時間:2006-07-23 22:15:20 IP:59.115.xxx.xxx 未訂閱

===================引 用 文 章===================

procedure TForm1.Button1Click(Sender: TObject);
var
FileName : String;
begin
FileName := edit1.text; //指定檔案名稱
glopen(_file_,FileName); //這應該是自定procedure...應該是開啟pdf檔案
LINE := 3;
try
MyPDF := TPDFDocument.Create(nil); //建立一個空的pdf檔案
try
MyPDF.FileName := edit1.text '.pdf'; //指定pdf檔名
MyPDF.DocumentInfo.Title := 'telefoonnummers'; //指定pdf標題
if Launch.Checked then
MyPDF.Autolaunch:= NOT MyPDF.AutoLaunch;

MyPDF.Compression := ctFlate; //不壓縮pdf
MyPDF.BeginDoc; //pdf文件開始
while NOT EOF(_file_) do
begin
with MyPDF.CurrentPage do
begin
BeginText; //這應該是自定procedure
SetActiveFont('Arial', [], 8, CHINESEBIG5_CHARSET); //設定pdf使用的字型
ReadLN( _file_, _string_ ); //這應該也是自定procedure 讀取_file_檔案內的字串放入_string_
TextOut(20, (10*line) , 0, _string_); //自定procedure 將_string_變數值寫入pdf指定的行數
INC(line); //行數 1
if line mod 79 = 0 then //如果行數=79 進行換頁動作換頁
begin
line := 1; //行數從第一行起算
SetActiveFont('Arial', [], 10, CHINESEBIG5_CHARSET); //跟上面一樣.定義pdf字體
if page_nr.checked then //某個checkbox
TextOut(280, 800 , 0, 'page ' IntToStr(Mypdf.PageCount)); //寫入頁碼
Mypdf.Newpage; //換頁
end;
EndText; //結束文字檔
end;
end;
try
MyPDF.EndDoc; //結束pdf檔案
except
on Exception do //如果發生錯誤
begin
MyPDF.Abort; //pdf中斷
raise;
end;
end;
finally //完成之後
MyPDF.Free; //釋放MyPDF記憶體
end;
except
on E: Exception do //發生錯誤 顯示錯誤訊息
Writeln(E.message);
end;


因為你只有給一個按鈕內的程式碼,很多procedure都只能照他的名稱來猜,這應該是一個指定文件檔案位置之後,動態建立成一個pdf檔案的程序

對吧~~~~~~!!!!

mayday741130
一般會員


發表:11
回覆:8
積分:3
註冊:2006-07-22

發送簡訊給我
#3 引用回覆 回覆 發表時間:2006-07-24 14:12:23 IP:210.70.xxx.xxx 未訂閱

嗯,對~

謝謝你囉~~~超感謝的~!!!

------
小LO
系統時間:2024-04-25 0:43:27
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!