Delphi 生成網頁 html 報表

2022-04-05 22:08:56 字數 1301 閱讀 3824

舉個很簡單的例子,頭部:

html_lzs_head_one=

''+''

+''+'分公司: '

+'%s

' +''

+'經營小組: '

+'%s

' +''

+'門店: '

+'%s

' +''

+'年: '

+'%s

' +''

+'月: '

+'%s

' +''

+'單據狀態: '

+'%s

' +' '

+' ';

從資料庫中查詢資料,得到結果,並填充

f_head_one:=format(html_lzs_head_one,

[aqrypublic.fieldbyname('subcompany_id').asstring,

aqrypublic.fieldbyname('working_group').asstring,

aqrypublic.fieldbyname('shop_id').asstring,

aqrypublic.fieldbyname('reference_year').asstring,

aqrypublic.fieldbyname('reference_month').asstring,fstate]);

這樣我們就生成了一小段 html  **,如何顯示在webbrowser上呢?

procedure tfrmreport.showhtml(content: widestring);

var v: variant;

htmldocument: ihtmldocument2;

begin

v := vararraycreate([0, 0], varvariant);

v[0] := content;

htmldocument := webbrowser1.document as ihtmldocument2;

htmldocument.write(psafearray(tvardata(v).varray));

htmldocument.close;

htmldocument := nil;

end;

另外要注意

initialization

oleinitialize(nil);

finalization

oleuninitialize;

Delphi 生成網頁 html 報表

舉個很簡單的例子,頭部 html lzs head one 分公司 s 經營小組 s 門店 s 年 s 月 s 單據狀態 s 從資料庫中查詢資料,得到結果,並填充 f head one format html lzs head one,aqrypublic.fieldbyname subcompan...

採用html模板生成靜態網頁

利用自己已有的xml配置讀取和格式化資料的功能,採用自定義標籤實現 頁面html模板生成靜態網頁。自定義標籤如下 表名.記錄索引.欄位名 例如 t.0.id 表示t表的第一行的id欄位的值 repeat row 表名 行重複內容 repeat row 表名 例如 repeat row t 表示此處迴...

採用html模板生成靜態網頁

利用自己已有的xml配置讀取和格式化資料的功能,採用自定義標籤實現 頁面html模板生成靜態網頁。自定義標籤如下 表名.記錄索引.欄位名 例如 t.0.id 表示t表的第一行的id欄位的值 repeat row 表名 行重複內容 repeat row 表名 例如 repeat row t 表示此處迴...