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

[基本問題]請問pascal如何匯出word, Excel跟html,另請各位給我program一點建議

答題得分者是:christie
mahoihei
一般會員


發表:6
回覆:6
積分:2
註冊:2009-08-10

發送簡訊給我
#1 引用回覆 回覆 發表時間:2009-10-09 17:21:58 IP:119.236.xxx.xxx 訂閱
怎可以做到??


另外附上本人的公開試上呈的東西,請大家給點建議,這是一個電話簿
christie
資深會員


發表:30
回覆:299
積分:475
註冊:2005-03-25

發送簡訊給我
#2 引用回覆 回覆 發表時間:2009-10-30 10:09:53 IP:59.125.xxx.xxx 未訂閱
Delphi匯出html:


function ListViewConfHTML(Listview:TListview; output:string; center: Boolean) : Boolean;
var
i,f: Integer;
tfile: TextFile;
begin
try
ForceDirectories(ExtractFilePath(output));
AssignFile(tfile,output);
ReWrite(tfile);
WriteLn(tfile,'<html>');
WriteLn(tfile,'<head>');
WriteLn(tfile,'<title>HTML-Ansicht: ' listview.Name '</title>');
WriteLn(tfile,'</head>');
WriteLn(tfile,'');
WriteLn(tfile,'');
for i := 0 to listview.Columns.Count - 1 do
begin
if center then
WriteLn(tfile,'') else
WriteLn(tfile,'');
end;
WriteLn(tfile,'');
WriteLn(tfile,'');
for i := 0 to listview.Items.Count-1 do
begin
WriteLn(tfile,'');
for f := 0 to listview.Columns.Count-2 do
begin
if listview.items.item[i].subitems[f]='' then Write(tfile,'') else
Write(tfile,'');
end;
Write(tfile,'');
end;
WriteLn(tfile,'
' listview.columns[i].caption '
' listview.columns[i].caption '
' listview.items.item[i].caption '-' listview.items.item[i].subitems[f] '
');
WriteLn(tfile,'</html>');
CloseFile(tfile);
Result := True;
except
Result := False;
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
const
Names: array[0..5, 0..1] of string = (
('Rubble', 'Barney'),
('Michael', 'Johnson'),
('Bunny', 'Bugs'),
('Silver', 'HiHo'),
('Simpson', 'Bart'),
('Squirrel', 'Rocky')
);

var
I: Integer;
NewColumn: TListColumn;
ListItem : TListItem;

begin
with ListView1 do
begin
Parent := Self;
//Align := alClient;

ViewStyle := vsReport;
NewColumn := Columns.Add;
NewColumn.Caption := 'Last';
NewColumn := Columns.Add;
NewColumn.Caption := 'First';
for I := Low(Names) to High(Names) do
begin
ListItem := Items.Add;
ListItem.Caption := Names[I][0];
ListItem.SubItems.Add(Names[I][1]);
end;

end
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
if ListViewConfHTML(ListView1,'d:\text.html', true) then
ShowMessage('OK/ html')
else
ShowMessage('Error occured/ html');
end;


===================引 用 mahoihei 文 章===================
怎可以做到??


另外附上本人的公開試上呈的東西,請大家給點建議,這是一個電話簿

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