zoukankan      html  css  js  c++  java
  • C# winfrom FastReport Print

    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(@"FastReportOtEmpEdit.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);
                }
            }
  • 相关阅读:
    Python 基础 -2.4.2 生成器,迭代器
    Python 基础 -2.4.1 装饰器
    Python 基础 -2.4 函数进阶,名称空间,闭包,高阶函数,递归,匿名函数,生产式,生成器,迭代器
    Python 基础 -2.3 函数
    python中字典,元组,列表和字符串之间的转换
    input和raw_input区别
    Python 基础 -2.2 文件操作
    Golang之AES/DES加密解密
    Golang与MySQL
    RTFM
  • 原文地址:https://www.cnblogs.com/yimeishui/p/5797887.html
Copyright © 2011-2022 走看看