原創|行業資訊|編輯:何家巧|2023-01-03 11:53:32.740|閱讀 245 次
概述:在使用報表開發工具FastReport.NET的過程中,總會遇見授權或者使用問題,今天我們就聯合廠商為大家帶來10個常見問題的解答,希望能夠幫到大家。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
Fastreport是目前世界上主流的圖表控件,具有超高性價比,以更具成本優勢的價格,便能提供功能齊全的報表解決方案,連續三年蟬聯全球文檔創建組件和庫的“ Top 50 Publishers”獎。慧都科技是Fast Reports在中國區十余年的友好合作伙伴,連續多年被Fast Reports授予中國區Best Partner稱號。
上一篇我們了解了FastReport .Net五大常見問題及解決辦法,今天我們繼續討論常會遇見的問題和解決方法,今天將帶來10個問題的分享。
問題1:如何從代碼創建MSChartObject?
1.新建MSChart對象,設置寬高和圖例:
MSChartObject MSChart1 = new MSChartObject();
MSChart1.Width = 300;
MSChart1.Height = 300;
MSChart1.Chart.Legends.Add(new Legend() { Name = "Legend1", Title="Legend title"});
2. 創建 ChartArea 對象,設置名稱、軸標題并將創建的 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.創建Series對象,設置圖表類型,邊框寬度,添加點并為圖表分配系列:
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.將創建的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;
結果:
問題2:我的訂閱已過期,在哪里可以下載該產品的最新可訪問版本?
在 support.fast-report.com 上向我們發送有關此內容的電子郵件,我們將為您提供最接近您的版本。Report report = new Report();
report.LoadPrepared("1.fpx");
EnvironmentSettings s = new EnvironmentSettings();
s.ReportSettings.ShowProgress = false;
report.Show();
問題4:如何返回/ 重置默認的Designer設置?:建議您使用以下代碼段:
Report.Dictionary.Connections[0].Tables[0].Parameters[0].Value.ToString();
問題8:如何將HTML格式的報告嵌入到消息中并使用代碼通過電子郵件發送?
請使用以下代碼段
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
問題9:網絡演示不起作用
如果您無法從 Demos\C#\Web 文件夾運行演示,那么您可以:
3. 從根文件夾和視圖中的 Web.Config 中更改當前的構建版本。
問題10:如何將多份報告合二為一
對于桌面版您可以使用這個代碼段
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();
對于網頁版您可以使用這一段代碼
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;
關于“FastReport .NET中十大常見問題”的講解就到這里了,點擊查看關于更多常見問題的解答。
如您有更多相關問題,歡迎加入官方技術群交流解決。
FastReport技術QQ群:536197826 歡迎進群一起討論
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn