最简fastreport打印代码

 

//需要引用三个文件       
//D:\Patch\FastReport.dll
//D:\Patch\FastReport.Bars.dll
//D:\Patch\FastReport.Editor.dll

 

设计器中文语言包文件   Chinese (Simplified).frl

 

 

private void 打印()
{
     List<MyEntity> entities = new List<MyEntity>
     {
         new MyEntity { Name = "张三", Age = 20 },
         new MyEntity { Name = "李四", Age = 25 }
     };
     Report report = new Report();
     if (File.Exists("YourReport.frx"))
     {
         report.Load("YourReport.frx");  // 加载报表文件
     }


     report.RegisterData(entities, "Entities");  // 注册数据

    report.Design();  // 显示报表
}
class MyEntity
{
     public string Name { get; set; }
     public int Age { get; set; }
}

posted @ 2024-08-15 22:55  网络来者  阅读(14)  评论(0)    收藏  举报