實現原理
PowerBuilder中有一種以PSR為後綴的特殊的保存報表的文件格式(本文簡稱PSR文件)
首先
其次要保存報表格式
實現過程
string is_dwtype
//保存報表中對象的類型及名稱
blob emp_pic
long ll_handle
string ls_dwobject
ls_dwobject = dw_print
//判斷是否存在該數據窗口的報表格式
select count(*) into:ll_count from dyn_report where dwobject =:ls_dwobject;
if ll_count>
//讀取報表格式文件到大文本變量
selectblob memo into:emp_pic from dyn_report where dwobject =:ls_dwobject;
//創建PSR臨時文件並保存到硬盤
ls_reportfile =
ll_handle = FileOpen(is_reportfile
FileWrite(ll_handle
FileClose(ll_handle)
dw_print
dw_print
else
Dw_print
End if
Dw_print
string ls_filename
long ll_count
blob Emp_id_pic
ls_filename =
//保存報表格式到硬盤臨時文件
dw_print
sqlca
select count(*) into :ll_count from dyn_report where dwobject =:is_dwobject;
if ll_count =
insert into dyn_report(dwobject
values(
end if
//從硬盤臨時文件讀取數據保存到數據庫表中
emp_id_pic = of_readbmpfile(ls_filename)
//該函數將二進制文件內容讀到大文本對象中
UPDATEBLOB dyn_report SET memo = :Emp_id_pic where dwobject = :is_dwobject;
//更新數據庫
sqlca
string ls_type
//得到對象類型和名稱
ls_type = trim(upper(dwo
ls_dwoname = trim(dwo
is_dwtype = ls_type
choose case ls_type
case
is_dwobject = ls_dwoname
//設置為可以拖動和改變大小
this
this
case
//直線對象不能通過設置Resizeable和moveable屬性進行調整
is_dwobject = ls_dwoname
case
is_dwobject = ls_dwoname
this
this
case
is_dwobject = ls_dwoname
this
this
end choose
最後再通過modify()函數就可以實現基本的動態報表操作
本程序在PB
編輯推薦
ASP
Microsoft
From:http://tw.wingwit.com/Article/program/PB/201311/24637.html