1、引用

using FastReport;
using FastReport.Barcode;

2、code

      private void toolStripButtonPrint_Click(object sender, EventArgs e)
{
string textNewdate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
string textBarcode=string.Empty;
try
{
//seleCord = this.dataGridView1.SelectedRows[0].Cells[1].Value.ToString();//选中行的第一个单元格的值
string StrSql = "SELECT PID, SN, WorkNo, Name, Sex_Name, IDCard, Age, Education_Name, CONVERT(varchar(100), EntryDate, 23) as EntryDate," + "UseManFrom_Name, Post_Name, jobs_Name,TypeWork_Name, IDCardAdress, Mobile, "
+ "Security_Name, ContractTerm_Name,BrithDate, Sex, Education, UseManFrom, Post, Jobs, TypeWork, Security," + "ContractTerm,WorkDate,Nation,Duty,WorkTelphone,HomeTelphone,Email,WorkAddress, HomeAddress,"
+"Memo, Photo, IDCardImage"
+ " FROM tbEmployee where PID='" + iPid + "'"; Report FsReport = new Report();//实例化打印报表 SqlHelper helper = new SqlHelper();
ds = SqlHelper.SqlGetDataSet(StrSql, "v_tbEmployee");
//sda.Fill(dt,"tbDevCard");
//string reportpath = AppDomain.CurrentDomain.BaseDirectory+"\OtDevPgCard.frx";
//FsReport.Load(@"..\OtDevPgCard.frx");
FsReport.Load(@"FastReport\OtEmpEdit.frx");
FsReport.RegisterData(ds);
dt = ds.Tables[];
TextObject pTextPrint = FsReport.FindObject("TextPrintDate") as TextObject;
//TextObject pTextIDCard = FsReport.FindObject("TextIDCard") as TextObject;
textBarcode = dt.Rows[]["IDCard"].ToString(); //(FsReport.FindObject("Barcode2") as BarcodeObject).Text = "21000002009"; // strArray[3];
(FsReport.FindObject("Barcode2") as BarcodeObject).Text = textBarcode;
//pTextIDCard.Text = textBarcode;
pTextPrint.Text = textNewdate;
FsReport.Show();
FsReport.Dispose();
}
catch (Exception err)
{
MessageBox.Show(err.Message);
}
}

C# winfrom FastReport Print的更多相关文章

  1. C# winfrom FastReport 变量设计加载

    1.源码 DataTable dt5 = new DataTable(); dt5 = SqlHelper.SqlGetDataTable(StrSql, "tbEmpCont") ...

  2. 使用FastReport.net 报表在网页上实现打印功能

    这些年的工作当中,最早是在8年前接触到FastReport这个报表工具,从名字上来看,直译过来就是快速报表,正所谓天下武功,唯快不破,FastReport报表早些年确实是制作报表的不二之选,8年前的工 ...

  3. winfrom调用FastReport模板

    '存放模板的路径 If Dir(Application.StartupPath & "\ReportsFile\HB\01\IN.frx", FileAttribute.N ...

  4. MVC架构 使用FastReport

    1.Web.config文件 添加配置 <httpHandlers> <add path="FastReport.Export.axd" verb="* ...

  5. FastReport 使用说明

    FastReport TfrxReport 此为最主要的报表元件,一个 TfrxReport 元件组成一份报表.在设计时期,双击此 元件可打开报表设计器(Report Designer),此元件拥有所 ...

  6. FastReport 使用技巧篇

    使用技巧篇 1.FastReport中如果访问报表中的对象?       可以使用FindObject方法.      TfrxMemoView(frxReport1.FindObject('memo ...

  7. FASTREPORT 整理 (mtm)

    DELPHI中用FASTREPORT制作报表  1.加载并存储报表 默认情况下,报表窗体同项目窗体构存储在同一个DFM文件中.多数情况下,无须再操作,因而你就不必采用特殊方法加载报表. 如果你决定在文 ...

  8. FastReport经验

    FastReport经验 1.FastReport中如果访问报表中的对象? 可以使用FindObject方法. TfrxMemoView(frxReport1.FindObject(’memo1′)) ...

  9. FastReport使用一——简介

    一:FastReport Designer用法简介 1.使用FastReport.Net4文件夹下的Designer.exe进行模版的创建工作 图1 图1中,右键删除除==>数据区 之外的其他区 ...

随机推荐

  1. IntelliJ IDEA 中 右键新建时,选项没有Java class的解决方法和具体解释

    我是在别人问我的时候,才发现还可以有这个问题,主要是他新项目直接打开,什么都没配置,就打算新建文件,其实可以直接看编辑器右下角的event log,那个对话框点开的话,可以add as maven p ...

  2. 关于view里面xib的问题

    [[[NSBundle mainBundle] loadNibNamed:@"NetFailView" owner:self options:nil] lastObject]; 会 ...

  3. Spring插件的安装与卸载---笔记

    Spring插件的安装 1.在eclipse中选择工具菜单Help--->Install New Software选项 2.点击Add, 3.选择插件地址或输入网址,点击  OK  . http ...

  4. HTML中table边框的显示总结

    一.1.显示表格的4个边框:<table border frame=box>2.只显示上边框: <table border frame=above>3.只显示下边框: < ...

  5. Spring初学之泛型依赖注入

    主要讲泛型依赖注入,所以核心在java文件,配置文件中只需配置扫描包即可,如下: <?xml version="1.0" encoding="UTF-8" ...

  6. js职责链模式

    职责链模式(Chain of Responsiblity),使多个对象都有机会处理请求,从而避免请求的发送者和接收者之间的耦合关系.将这个对象连成一条链,并沿着这条链传递该请求,直到有一个对象处理它为 ...

  7. 02-大鸭梨博客系统数据库设计及Dapper的使用

    毫无疑问,数据库的设计在一个系统中起了至关重要的作用.我们都知道,系统设计分为两部分,或者说是两个阶段,即数据库设计和功能设计.构建一个完善的系统需要这两个阶段的充分考量.周密设计.合理联接以及密切配 ...

  8. wpf数据绑定的论述

    (1)绑定模式: <Lable x:Name=lab Content={binding UserName} /> <!--binding相当于SetBinding--> Con ...

  9. 隔行换色(WPF DataGrid 标准例子)

     <DataGrid AlternationCount="2">             <DataGrid.RowStyle>               ...

  10. C# WPF DataGrid 隔行变色及内容居中对齐

    C# WPF DataGrid 隔行变色及内容居中对齐. dqzww NET学习0     先看效果: 前台XAML代码: <!--引入样式文件--> <Window.Resourc ...