C#如何调用Fastreport
答案:2 悬赏:50 手机版
解决时间 2021-01-26 01:49
- 提问者网友:黑米和小志
- 2021-01-25 03:44
C#如何调用Fastreport
最佳答案
- 五星知识达人网友:青灯有味
- 2021-01-25 05:17
引用:FastReport.dll,FastReport.Bars.dll,FastReport.Editor.dll
设计好**.frx 文件
代码:
DataSet FDataSet = new DataSet();
DataTable table = new DataTable();
table.TableName = "Items";
FDataSet.Tables.Add(table);
table.Columns.Add("id", typeof(int));
table.Columns.Add("aaa", typeof(string));
table.Rows.Add(0,"ab");
table.Rows.Add(1,"abc");
FastReport.Report report1 = new FastReport.Report();
try
{
// load the existing report
report1.Load("***.frx");
// register the dataset
report1.RegisterData(FDataSet);
report1.GetDataSource("Items").Enabled = true;
// run the report
report1.Show();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
// free resources used by report
report1.Dispose();
}
设计好**.frx 文件
代码:
DataSet FDataSet = new DataSet();
DataTable table = new DataTable();
table.TableName = "Items";
FDataSet.Tables.Add(table);
table.Columns.Add("id", typeof(int));
table.Columns.Add("aaa", typeof(string));
table.Rows.Add(0,"ab");
table.Rows.Add(1,"abc");
FastReport.Report report1 = new FastReport.Report();
try
{
// load the existing report
report1.Load("***.frx");
// register the dataset
report1.RegisterData(FDataSet);
report1.GetDataSource("Items").Enabled = true;
// run the report
report1.Show();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
// free resources used by report
report1.Dispose();
}
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯