原創(chuàng)|行業(yè)資訊|編輯:何家巧|2023-01-03 11:53:32.740|閱讀 245 次
概述:在使用報(bào)表開(kāi)發(fā)工具FastReport.NET的過(guò)程中,總會(huì)遇見(jiàn)授權(quán)或者使用問(wèn)題,今天我們就聯(lián)合廠(chǎng)商為大家?guī)?lái)10個(gè)常見(jiàn)問(wèn)題的解答,希望能夠幫到大家。
# 界面/圖表報(bào)表/文檔/IDE等千款熱門(mén)軟控件火熱銷(xiāo)售中 >>
相關(guān)鏈接:
Fastreport是目前世界上主流的圖表控件,具有超高性?xún)r(jià)比,以更具成本優(yōu)勢(shì)的價(jià)格,便能提供功能齊全的報(bào)表解決方案,連續(xù)三年蟬聯(lián)全球文檔創(chuàng)建組件和庫(kù)的“ Top 50 Publishers”獎(jiǎng)。慧都科技是Fast Reports在中國(guó)區(qū)十余年的友好合作伙伴,連續(xù)多年被Fast Reports授予中國(guó)區(qū)Best Partner稱(chēng)號(hào)。
上一篇我們了解了FastReport .Net五大常見(jiàn)問(wèn)題及解決辦法,今天我們繼續(xù)討論常會(huì)遇見(jiàn)的問(wèn)題和解決方法,今天將帶來(lái)10個(gè)問(wèn)題的分享。
問(wèn)題1:如何從代碼創(chuàng)建MSChartObject?
1.新建MSChart對(duì)象,設(shè)置寬高和圖例:
MSChartObject MSChart1 = new MSChartObject();
MSChart1.Width = 300;
MSChart1.Height = 300;
MSChart1.Chart.Legends.Add(new Legend() { Name = "Legend1", Title="Legend title"});
2. 創(chuàng)建 ChartArea 對(duì)象,設(shè)置名稱(chēng)、軸標(biāo)題并將創(chuàng)建的 ChartArea 分配給 MSChart:
ChartArea chartArea1 = new ChartArea();
chartArea1.Name = "ChartArea1";
chartArea1.Axes[0].Title = "X name";
chartArea1.Axes[1].Title = "Y name";
MSChart1.Chart.ChartAreas.Add(chartArea1);
3.創(chuàng)建Series對(duì)象,設(shè)置圖表類(lèi)型,邊框?qū)挾龋砑狱c(diǎn)并為圖表分配系列:
Series series = new Series("sample");
series.ChartType = SeriesChartType.Line;
series.BorderWidth = 2;
series.Points.Add(new DataPoint(0, 1));
series.Points.Add(new DataPoint(1, 2));
series.Points.Add(new DataPoint(3, 5));
series.Points.Add(new DataPoint(4, 8));
MSChart1.Chart.Series.Add(series);
4.將創(chuàng)建的MSChart賦值給DataBand:
Report report = new Report();
report.Load("ok.frx");
DataBand db = report.FindObject("Data1") as DataBand;
MSChart1.Parent = db;
和完整的片段:
MSChartObject MSChart1 = new MSChartObject();
MSChart1.Width = 300;
MSChart1.Height = 300;
MSChart1.Chart.Legends.Add(new Legend() { Name = "Legend1", Title="Legend title"});
ChartArea chartArea1 = new ChartArea();
chartArea1.Name = "ChartArea1";
chartArea1.Axes[0].Title = "X name";
chartArea1.Axes[1].Title = "Y name";
MSChart1.Chart.ChartAreas.Add(chartArea1);
Series series = new Series("sample");
series.ChartType = SeriesChartType.Line;
series.BorderWidth = 2;
series.Points.Add(new DataPoint(0, 1));
series.Points.Add(new DataPoint(1, 2));
series.Points.Add(new DataPoint(3, 5));
series.Points.Add(new DataPoint(4, 8));
MSChart1.Chart.Series.Add(series);
Report report = new Report();
report.Load("ok.frx");
DataBand db = report.FindObject("Data1") as DataBand;
MSChart1.Parent = db;
結(jié)果:
問(wèn)題2:我的訂閱已過(guò)期,在哪里可以下載該產(chǎn)品的最新可訪(fǎng)問(wèn)版本?
在 support.fast-report.com 上向我們發(fā)送有關(guān)此內(nèi)容的電子郵件,我們將為您提供最接近您的版本。Report report = new Report();
report.LoadPrepared("1.fpx");
EnvironmentSettings s = new EnvironmentSettings();
s.ReportSettings.ShowProgress = false;
report.Show();
問(wèn)題4:如何返回/ 重置默認(rèn)的Designer設(shè)置?:建議您使用以下代碼段:
Report.Dictionary.Connections[0].Tables[0].Parameters[0].Value.ToString();
問(wèn)題8:如何將HTML格式的報(bào)告嵌入到消息中并使用代碼通過(guò)電子郵件發(fā)送?
請(qǐng)使用以下代碼段
Report report = new Report();
report.LoadPrepared("preparedreport.fpx");
HTMLExport htmlExport = new HTMLExport()
{
SubFolder = false,
Navigator = false,
Pictures = true,
EmbedPictures = true,
SinglePage = true,
Layers = true,
HasMultipleFiles = false
};
EmailExport email = new EmailExport();
//email mailer settings
email.Account.Address = "Email@gmail.com";
email.Account.Name = "Usename";
email.Account.Host = "smtp.yandex.ru";
email.Account.Port = 25;
email.Account.UserName = "Email";
email.Account.Password = "password";
email.Account.MessageTemplate = "Test";
email.Account.EnableSSL = true;
//email addressee settings
email.Address = "Destinationaddress@gmail.com";
email.Subject = "Embedding of html";
email.Export = htmlExport; //Set export type
email.SendEmail(report); //Send email
問(wèn)題9:網(wǎng)絡(luò)演示不起作用
如果您無(wú)法從 Demos\C#\Web 文件夾運(yùn)行演示,那么您可以:
3. 從根文件夾和視圖中的 Web.Config 中更改當(dāng)前的構(gòu)建版本。
問(wèn)題10:如何將多份報(bào)告合二為一
對(duì)于桌面版您可以使用這個(gè)代碼段
Report report = new Report();
report.Load(Path.GetFullPath(@"..\..\Report1.frx"));
report.Prepare(true);
report.Load(Path.GetFullPath(@"..\..\Report2.frx"));
report.Prepare(true);
report.Load(Path.GetFullPath(@"..\..\Report3.frx"));
report.Prepare(true);
report.ShowPrepared();
對(duì)于網(wǎng)頁(yè)版您可以使用這一段代碼
webReport.Report.Load(Path.GetFullPath(@"..\..\Report1.frx"));
webReport.Report.Prepare(true);
webReport.Report.Load(Path.GetFullPath(@"..\..\Report2.frx"));
webReport.Report.Prepare(true);
webReport.Report.Load(Path.GetFullPath(@"..\..\Report3.frx"));
webReport.Report.Prepare(true);
webReport.ShowRefreshButton = false;
webReport.ReportDone = true;
關(guān)于“FastReport .NET中十大常見(jiàn)問(wèn)題”的講解就到這里了,點(diǎn)擊查看關(guān)于更多常見(jiàn)問(wèn)題的解答。
如您有更多相關(guān)問(wèn)題,歡迎加入官方技術(shù)群交流解決。
FastReport技術(shù)QQ群:536197826 歡迎進(jìn)群一起討論
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請(qǐng)務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請(qǐng)郵件反饋至chenjj@fc6vip.cn