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);
                }
            }
  • 相关阅读:
    MongoDB 查询$关键字 $in $or $all
    MongoDB limit 选取 skip跳过 sort排序 方法
    POJ 1700
    POJ 1666
    POJ 1701
    POJ 1674
    POJ 1664
    POJ 1665
    POJ 1658
    POJ 1656
  • 原文地址:https://www.cnblogs.com/yimeishui/p/5797887.html
Copyright © 2011-2022 走看看