翻譯|使用教程|編輯:李顯亮|2021-09-14 10:35:56.970|閱讀 163 次
概述:此示例顯示如何在運(yùn)行系統(tǒng)中創(chuàng)建一個(gè)簡單的報(bào)告。讓我們創(chuàng)建包含標(biāo)題、數(shù)據(jù)、總計(jì)的報(bào)告并將其顯示在查看器中。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關(guān)鏈接:
Stimulsoft Ultimate是用于創(chuàng)建報(bào)表和儀表板的通用工具集。該產(chǎn)品包括用于WinForms、ASP.NET、.NET Core、JavaScript、WPF、PHP、Java和其他環(huán)境的完整工具集。
Stimulsoft Reports不僅擁有強(qiáng)大的報(bào)表導(dǎo)出系統(tǒng),而且還支持多種報(bào)表導(dǎo)出格式,擁有簡單且強(qiáng)大的報(bào)表引擎。Stimulsoft Reports基本原則是,用簡單常規(guī)的方法創(chuàng)建報(bào)表,將不同的技術(shù)應(yīng)用于應(yīng)用程序。Stimulsoft Reports ..NET一個(gè)基于.NET框架的報(bào)表生成器,能夠幫助你創(chuàng)建結(jié)構(gòu)、功能豐富的報(bào)表。不僅界面友好,而且使用便捷,能夠讓你輕松創(chuàng)建所有報(bào)表。
點(diǎn)擊下載Stimulsoft Reports .NET v2021.3.1最新版
此示例顯示如何在運(yùn)行系統(tǒng)中創(chuàng)建一個(gè)簡單的報(bào)告。讓我們創(chuàng)建包含標(biāo)題、數(shù)據(jù)、總計(jì)的報(bào)告并將其顯示在查看器中。首先,創(chuàng)建一個(gè)新報(bào)告并將數(shù)據(jù)源添加到字典中:
private void button1_Click(object sender, System.EventArgs e) { StiReport report = new StiReport(); // Add data to datastore report.RegData(dataSet1); // Fill dictionary report.Dictionary.Synchronize(); StiPage page = report.Pages[0]; ...
添加帶有文本框的標(biāo)題帶并為其分配數(shù)據(jù)標(biāo)題:
... // Create HeaderBand StiHeaderBand headerBand = new StiHeaderBand(); headerBand.Height = 0.5; headerBand.Name = "HeaderBand"; page.Components.Add(headerBand); // Create text on header StiText headerText = new StiText(new RectangleD(0, 0, 5, 0.5)); headerText.Text = "CompanyName"; headerText.HorAlignment = StiTextHorAlignment.Center; headerText.Name = "HeaderText"; headerText.Brush = new StiSolidBrush(Color.LightGreen); headerBand.Components.Add(headerText); ...
接下來,添加一個(gè)帶有文本框的數(shù)據(jù)帶,其中包含對數(shù)據(jù)字段的引用:
... // Create Databand StiDataBand dataBand = new StiDataBand(); dataBand.DataSourceName = "Customers"; dataBand.Height = 0.5; dataBand.Name = "DataBand"; page.Components.Add(dataBand); // Create text StiText dataText = new StiText(new RectangleD(0, 0, 5, 0.5)); dataText.Text = "{Line}.{Customers.CompanyName}"; dataText.Name = "DataText"; dataBand.Components.Add(dataText); ...
接下來,添加一個(gè)帶有文本框的數(shù)據(jù)帶,其中包含對數(shù)據(jù)字段的引用:
... // Create Databand StiDataBand dataBand = new StiDataBand(); dataBand.DataSourceName = "Customers"; dataBand.Height = 0.5; dataBand.Name = "DataBand"; page.Components.Add(dataBand); // Create text StiText dataText = new StiText(new RectangleD(0, 0, 5, 0.5)); dataText.Text = "{Line}.{Customers.CompanyName}"; dataText.Name = "DataText"; dataBand.Components.Add(dataText); ...
接下來,添加一個(gè)帶有文本框的頁腳帶,其中包含數(shù)據(jù)總計(jì)的函數(shù):
... // Create FooterBand StiFooterBand footerBand = new StiFooterBand(); footerBand.Height = 0.5; footerBand.Name = "FooterBand"; page.Components.Add(footerBand); // Create text on footer StiText footerText = new StiText(new RectangleD(0, 0, 5, 0.5)); footerText.Text = "Count - {Count()}"; footerText.HorAlignment = StiTextHorAlignment.Right; footerText.Name = "FooterText"; footerText.Brush = new StiSolidBrush(Color.LightGreen); footerBand.Components.Add(footerText); ...
最后,在查看器中顯示一個(gè)報(bào)告:
... report.Show(); }
在下面的屏幕截圖中,您可以看到示例代碼的結(jié)果:
Aspose、E-iceblue、FastReport、Stimulsoft等文檔/報(bào)表圖表類開發(fā)工具享超低折扣,如有需要可直接。
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn