C#如何编写POS机打印小票功能 我最近要用C#编写POS机打印小票功能,可是不知道该如何写,还有就是小票打印完之后是POS机的自动裁纸,还是我的C#程序里自己编写裁纸功能啊。困惑啊,没有思路...能给个实例嘛。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 应该有对应的POST机,API函数,你可以问厂商要一下,如果是通用的,就没必要了。裁纸是自带的,因为他打印的区域是固定的 我都是在EXCEL里面建好模板,用C#把数据添加到模板里,直接打印 那我在用C#写程序的时候是不是就不用考虑写裁纸的代码了,只写打印的就可以???那如果是一卷纸如果没有裁纸代码,那POS自己会自动识别打印完自动裁纸吗? 你先创建一个EXCEL表格,设置好打印区域还有打印机打印的纸张大小。定义了打印纸张后打印,他就会自动停在你打印的位置...建好模板后,在C#中引用EXCEL就像这样Microsoft.Office.Interop.Excel.Application excel = null; Microsoft.Office.Interop.Excel.Workbook xBook = null; Microsoft.Office.Interop.Excel._Worksheet wks = null; string dataFilePath = System.Environment.CurrentDirectory + @"\Model.xls"; try { excel = new Microsoft.Office.Interop.Excel.Application(); excel.Visible = false; excel.DisplayAlerts = false; //excel.ActivePrinter = "Citizen CLP-521Z"; xBook = excel.Application.Workbooks._Open(dataFilePath, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing); if (xBook == null) { xBook = excel.Application.Workbooks.Add(true); } wks = (Microsoft.Office.Interop.Excel._Worksheet)xBook.ActiveSheet; //取得当前worksheet wks.Cells[2, 2] = "'" + sScheduleDate;//.Remove(10); wks.Cells[3, 2] = "'" + sPatientID; wks.Cells[4, 2] = "'" + sName; wks.Cells[5, 2] = "'" + sSex; wks.Cells[5, 4] = "'" + nAge; wks.Cells[6, 2] = "'" + sCheckType; object omo = new object(); //打印预览 //wks.PrintPreview(omo); //不预览打印 wks.PrintOut(1, 1, 1, false, Type.Missing, Type.Missing, Type.Missing, Type.Missing); //wks.PrintOut(omo, omo, omo, omo, omo, omo, omo, omo); //xBook.Saved = true; xBook.Save(); excel.Application.Workbooks.Close(); excel.Application.Quit(); excel.Quit(); System.Runtime.InteropServices.Marshal.ReleaseComObject(excel); http://download.csdn.net/detail/mjp1234airen4385/1664218以前使用pos打印机写一个类。 工具箱中拉一个printDocument直接在printDocument1_PrintPage写打印内容 private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { //你要做的事 }在接Button事件中printDocument1.print() http://apps.hi.baidu.com/share/detail/31171999http://gbigone.blog.163.com/blog/static/350015292009101831349542/ C#.NET将输入日期与农历日期对应问题,求解 天气预报的信息什么意思? 如何让asp.net的TreeView控件展开事件(TreeNodeExpand)只触发一次 如何在类库中调用窗体控件 c#传参数,在线等。谢谢各位 弹出提示框~~~~~~~ 输入问题? UserControl的Collection属性语法问题(Up有分) 求远程处理客户端激活的源代码样例 求助:我的VS.net源代码管理中的子菜单全部无效?不知什么条件下才能激活呢?谢谢!!! Winform是基于什么协议请求数据的 如何把系统鼠标的图标修改成为其他的图片?
Microsoft.Office.Interop.Excel.Application excel = null;
Microsoft.Office.Interop.Excel.Workbook xBook = null;
Microsoft.Office.Interop.Excel._Worksheet wks = null;
string dataFilePath = System.Environment.CurrentDirectory + @"\Model.xls";
try
{
excel = new Microsoft.Office.Interop.Excel.Application();
excel.Visible = false;
excel.DisplayAlerts = false;
//excel.ActivePrinter = "Citizen CLP-521Z";
xBook = excel.Application.Workbooks._Open(dataFilePath, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing, Missing); if (xBook == null)
{
xBook = excel.Application.Workbooks.Add(true);
} wks = (Microsoft.Office.Interop.Excel._Worksheet)xBook.ActiveSheet; //取得当前worksheet
wks.Cells[2, 2] = "'" + sScheduleDate;//.Remove(10);
wks.Cells[3, 2] = "'" + sPatientID;
wks.Cells[4, 2] = "'" + sName;
wks.Cells[5, 2] = "'" + sSex;
wks.Cells[5, 4] = "'" + nAge;
wks.Cells[6, 2] = "'" + sCheckType;
object omo = new object();
//打印预览
//wks.PrintPreview(omo);
//不预览打印
wks.PrintOut(1, 1, 1, false, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
//wks.PrintOut(omo, omo, omo, omo, omo, omo, omo, omo);
//xBook.Saved = true;
xBook.Save();
excel.Application.Workbooks.Close();
excel.Application.Quit();
excel.Quit();
System.Runtime.InteropServices.Marshal.ReleaseComObject(excel);
以前使用pos打印机写一个类。
{
//你要做的事
}
在接Button事件中
printDocument1.print()
http://gbigone.blog.163.com/blog/static/350015292009101831349542/