Goldprinter (Gold printing), this printing of the third-party plug-in is very convenient, you can directly use the Excel template set dozen, I contact is not deep, only for the novice reference, I am also in the Goldprinter provide source code reference after the development.
The exact order is as follows:
1. Draw Excel form template first
2, write code to the template cell assignment value
3. Program Printing
Well, the order is basically like this, do is a very simple printing example, the business situation is like this, one-time printing multiple orders, an order for multiple goods, and finally print out fanfold, print as
Well, the print results come out, directly on the code.
Private voidButton1_Click (Objectsender, EventArgs e) { //Get Data collectionlt =Getdelivery.getdeliveryinfos (DELIVERY_SN, ORDER_SN, status); if(Lt.) Count <1) {MessageBox.Show ("The current condition has no data","System Tips", MessageBoxButtons.OK, Messageboxicon.asterisk); } Else { for(inti =0; I < Lt. Count; i++) {Delivery DV=Lt[i]; goldprinter.excelaccess Excel=Newgoldprinter.excelaccess (); stringstrFileName ="delivery slip. XLT";//Template file name stringStrexceltemplatefile = System.AppDomain.CurrentDomain.BaseDirectory +"template//"+strFileName; Excel. Open (Strexceltemplatefile); //using template filesExcel. Isvisibledexcel =true; Excel. Setcelltext (3,"D", Dv.customer_name); Excel. Setcelltext (3,"H", Dv.mobile); Excel. Setcelltext (3,"K", DV.DELIVERY_SN); Excel. Setcelltext (4,"D", dv.address); Excel. Setcelltext (4,"H", DV.ORDER_SN); Excel. Setcelltext (4,"K", dv.delivery_date); List<good> Lt_good =dv.goodlist; for(intj =0; J < (Lt_good. Count >Ten?Ten: Lt_good. Count); J + +) {Excel. Setcelltext (6M"B", (1+j). ToString ()); Excel. Setcelltext (6M"C", Lt_good[j].name); Excel. Setcelltext (6+ J,"F","");//SpecificationsExcel. Setcelltext (6+ J,"G","");//UnitExcel. Setcelltext (6M"H", Lt_good[j].number. ToString ()); Excel. Setcelltext (6M"I", Lt_good[j].price. ToString ("0.00")); Excel. Setcelltext (6M"J", Lt_good[j].totalmoney. ToString ("0.00")); Excel. Setcelltext (6M"K","");//Notes } stringUppermoney = GoldPrinter.ChineseNum.GetUpperMoney (Double.Parse (Excel. Getcelltext ( -,"J"))); Excel. Setcelltext ( -,"E", Uppermoney); Excel. PrintPreview (); Excel. Close (); //Close and releaseThread.Sleep ( -); } } }
View Code
Above is preview print, if need direct printing just put Excel. PrintPreview () changes directly to Excel. Print (). There are two DLLs involved, depending on the attachment
DLL Package
Goldprinter Source Code
Goldprinter Gold Print