各位大侠:本人现在急需开发打印这个模块。其基本要求就是在已经印刷好的票据上对应的空白处。填上对应的数字或者信息。很类似你去银行存钱。然后他的打印机给你对应打印出票据的功能。在下只在c/s模式下做过。vb不是有那个叫print之类的控件吗?C#中怎么弄啊。有没有好的建议。本人强给分拉。

解决方案 »

  1.   

    DataTable myTable = new DataTable("myTable");
     PrintRowVersion(myTable, DataRowVersion.Current);
      

  2.   

    private void PrintRowVersion(DataTable dt, DataRowVersion ver){
       // Print a new line and the version using the ReturnRowVersion function.
       Console.WriteLine("\n" + ver.ToString() + " Version:");
       // Print the value of each column in each row.
       try{
          foreach(DataRow row in dt.Rows ) {
          // Print the specified version of the row's value.
          Console.Write(row[0,ver] + ", ");
          Console.Write(row[1,ver] + "\n");
          }
       }
       catch(Exception e) {
       // Process exception and return.
           System.Diagnostics.EventLog log = new System.Diagnostics.EventLog();
           log.Source = "My Application";
           log.WriteEntry(e.ToString());
           Console.WriteLine("Exception of type {0} occurred.", e.GetType());
       }
    }
      

  3.   

    我用的是GoldPrinte,它调用excel模板进行打印,但是打印内容的位置很难调,我也不知道怎么设置打印的纸张大小,好让它打印完一张之后打下一张时,不用调整位置???
      

  4.   

    private void Print_Click(object sender, System.EventArgs e)
    {
    GoldPrinter.ExcelAccess excel = new GoldPrinter.ExcelAccess();
    Print(excel);
    excel.Print(); //

    excel.Close();
    } private void Print(GoldPrinter.ExcelAccess excel)
    {


    //制作步骤:
    /* 1、用Excel作出与要打印的样式一样的电子表格存为模板;
     *     技巧:最好把第一行与第一列作为空行,以利于调整边距(虽然Excel、打印机可调整页边距), 尽量的在需要调整的地方多空几行与几列,以利于调整套打对准
     * 
     *  2、如同本程序一样,将Excel作为套打的模板,直接将要打印的数据写入;
     * 
     *  3、打印,根据实际的效果调整Excel模板行高列宽及空出的行列, 直到能够准确的套上。*/
     

    // GoldPrinter.ExcelAccess excel = new GoldPrinter.ExcelAccess();
    string strFileName="";
    string strExcelTemplateFile ="";

    DateTime dtoday=System.DateTime.Now;
    string strtoday=dtoday.ToShortDateString();
    string stryear=dtoday.Year.ToString();
    string strmonth=dtoday.Month.ToString();
    string strday=dtoday.Day.ToString(); strFileName="Receipt-cw.xlt";
    strExcelTemplateFile = this.getpath()+strFileName;
    excel.Open(strExcelTemplateFile);
    excel.FormCaption = "收费收据模板";
    //在模板中写入要打印的数据

    //第一联
    excel.SetCellText(7,"D",X_MC.ToString());
    excel.SetCellText(7,"G",XS_XH.ToString());
    excel.SetCellText(8,"D",XS_XM.ToString());
    excel.SetCellText(8,"G",strtoday);
    excel.SetCellText(13,"C","补费");
    excel.SetCellText(13,"F",totaljfje.ToString()); //第二联
    excel.SetCellText(7,"L",X_MC.ToString());
    excel.SetCellText(7,"O",XS_XH.ToString());
    excel.SetCellText(8,"L",XS_XM.ToString());
    excel.SetCellText(8,"O",strtoday);
    excel.SetCellText(13,"C","补费");
    excel.SetCellText(13,"F",totaljfje.ToString());
    //第三联
    excel.SetCellText(7,"T",X_MC.ToString());
    excel.SetCellText(7,"W",XS_XH.ToString());
    excel.SetCellText(8,"T",XS_XM.ToString());
    excel.SetCellText(8,"W",strtoday);
    excel.SetCellText(13,"C","补费");
    excel.SetCellText(13,"F",totaljfje.ToString()); }
      

  5.   

    如果谁需要GoldPrinter.dll,留个邮箱吧
      

  6.   

    [email protected] 快给我来个我好急的!小猪猪!