FastReport VCL程序員手冊(cè):借助代碼構(gòu)建報(bào)告
FastReport VCL是用于Delphi,C ++ Builder,RAD Studio和Lazarus的報(bào)告和文檔創(chuàng)建VCL庫(kù)。它提供了可視化模板設(shè)計(jì)器,可以訪問(wèn)為30多種格式,并可以部署到云,網(wǎng)站,電子郵件和打印中。
近日,F(xiàn)astReport VCL更新至v6.9,在新版本中,在PDF更新中增加了對(duì)以下對(duì)象的并行表單支持:文本,替換和圖片。能夠通過(guò)InteractiveForms字體子集屬性將所需的字形僅包含在相互之間形式中。同時(shí)修復(fù)了多個(gè)Bug問(wèn)題。歡迎下載體驗(yàn)。(旁邊向下按鈕下載)
立即點(diǎn)擊下載FastReport VCL v6.9最新版
FastReport引擎通常負(fù)責(zé)報(bào)表的構(gòu)建。它以特定順序顯示報(bào)告的頻段,次數(shù)與報(bào)告所連接的數(shù)據(jù)源所需的次數(shù)相同,因此形成了完整的報(bào)告。有時(shí)有必要?jiǎng)?chuàng)建非標(biāo)準(zhǔn)格式的報(bào)告,而FastReport引擎無(wú)法生成該報(bào)告。在這種情況下,可以借助TfrxReport.OnManualBuild事件來(lái)手動(dòng)構(gòu)建報(bào)告的功能。如果要定義此事件的處理程序,則FastReport引擎將管理發(fā)送給該事件。同時(shí),以以下方式更改了形成報(bào)告的職責(zé)分配:
FastReport引擎:
- 報(bào)告的準(zhǔn)備(腳本,數(shù)據(jù)源初始化,樂(lè)隊(duì)的樹(shù)形結(jié)構(gòu))
- 所有計(jì)算(聚合函數(shù),事件處理程序)
- 新頁(yè)面/列的形成(自動(dòng)顯示頁(yè)面/列的頁(yè)眉/頁(yè)腳,報(bào)告標(biāo)題/摘要)
- 其他日常工作
- bands的演出按一定順序
引擎由TfrxCustomEngine類(lèi)表示。此類(lèi)的實(shí)例的鏈接位于該TfrxReport.Engine屬性中。
讓我們舉一個(gè)簡(jiǎn)單的處理程序的例子。報(bào)告中有兩個(gè)“主數(shù)據(jù)”帶,它們未連接到數(shù)據(jù)。處理程序以隔行順序呈現(xiàn)這些頻段,每個(gè)頻段六次。在六個(gè)頻段之后,會(huì)出現(xiàn)一個(gè)很小的間隙。
Pascal:var i: Integer; Band1, Band2: TfrxMasterData; { find required bands } Band1 := frxReport1.FindObject('MasterData1') as TfrxMasterData; Band2 := frxReport1.FindObject('MasterData2') as TfrxMasterData; for i := 1 to 6 do begin { lead/deduce bands one after another } frxReport1.Engine.ShowBand(Band1); frxReport1.Engine.ShowBand(Band2); { make a small gap } if i = 3 then frxReport1.Engine.CurY := frxReport1.Engine.CurY + 10; end;C ++:
int i; TfrxMasterData * Band1; TfrxMasterData * Band2; // find required bands Band1 := dynamic_cast <TfrxMasterData *> (frxReport1->FindObject("MasterData1")); Band2 := dynamic_cast <TfrxMasterData *> (frxReport1->FindObject("MasterData2")); for(i = 1; i <= 6; i++) { // lead/deduce bands one after another frxReport1->Engine->ShowBand(Band1); frxReport1->Engine->ShowBand(Band2); // make a small gap if(i == 3) frxReport1->Engine->CurY += 10; }下一個(gè)示例顯示兩組bands并排放置。
Pascal:
var i, j: Integer; Band1, Band2: TfrxMasterData; SaveY: Extended; Band1 := frxReport1.FindObject('MasterData1') as TfrxMasterData; Band2 := frxReport1.FindObject('MasterData2') as TfrxMasterData; SaveY := frxReport1.Engine.CurY; for j := 1 to 2 do begin for i := 1 to 6 do begin frxReport1.Engine.ShowBand(Band1); frxReport1.Engine.ShowBand(Band2); if i = 3 then frxReport1.Engine.CurY := frxReport1.Engine.CurY + 10; end; frxReport1.Engine.CurY := SaveY; frxReport1.Engine.CurX := frxReport1.Engine.CurX + 200; end;C ++:
int i, j; TfrxMasterData * Band1; TfrxMasterData * Band2; Extended SaveY; Band1 = dynamic_cast <TfrxMasterData *> (frxReport1->FindObject("MasterData1")); Band2 = dynamic_cast <TfrxMasterData *> (frxReport1->FindObject("MasterData2")); SaveY = frxReport1->Engine->CurY; for(j = 1; j <= 2; j++) { for(i = 1; i <= 6; i++) { frxReport1->Engine->ShowBand(Band1); frxReport1->Engine->ShowBand(Band2); if(i == 3) frxReport1->Engine->CurY += 10; } frxReport1->Engine->CurY = SaveY; frxReport1->Engine->CurX += 200; }
如果您對(duì)FastReport感興趣,歡迎加入FastReport QQ交流群:801349317
還想要更多嗎?您可以點(diǎn)擊閱讀【FastReport報(bào)表2020最新資源盤(pán)點(diǎn)】,查找需要的教程資源。讓人興奮的是FastReport .NET正在慧都網(wǎng)火熱銷(xiāo)售中!>>查看價(jià)格詳情