码迷,mamicode.com
首页 > Windows程序 > 详细

C# winfrom FastReport Print

时间:2016-08-23 09:04:58      阅读:983      评论:0      收藏:0      [点我收藏+]

标签:

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[0];
                TextObject pTextPrint = FsReport.FindObject("TextPrintDate") as TextObject;
                //TextObject pTextIDCard = FsReport.FindObject("TextIDCard") as TextObject;
                textBarcode = dt.Rows[0]["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

标签:

原文地址:http://www.cnblogs.com/yimeishui/p/5797887.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!