protected void PrintExcelF7() { if (vehicle.DyHtzbh.Length > 0) { GoldPrinter.ExcelAccess excel = new GoldPrinter.ExcelAccess(); string strExcelTemplateFile = Application.StartupPath + "/template/" + "抵押登记表.xls"; excel.Open(strExcelTemplateFile); excel.IsVisibledExcel = false; //excel.SetCellText(5, 6, "R"+"抵押登记 □解除抵押登记 □质押 □解除质押"); //excel.SetFont(5, 6, 5, 6, this.GouFont); excel.SetCellText(7, 6, " " + vehicle.BaseSyrName); excel.SetCellText(8, 6, " " + comp.Name); excel.SetCellText(10, 6, " " + comp.Address); excel.SetCellText(12, 6, " " + comp.PostCode.Substring(0, 4) + "00"); excel.SetCellText(12, 12, " " + comp.Phone); excel.SetCellText(13, 6, " " + comp.Email); excel.SetCellText(14, 6, " " + vehicle.BaseJbrName); excel.SetCellText(14, 12, " " + comp.Phone); excel.SetCellText(15, 6, " " + vehicle.DyDyqrName); excel.SetCellText(17, 6, " " + vehicle.DyDyqrConnAddress); excel.SetCellText(18, 6, " " + vehicle.DyDyqrPostCode); excel.SetCellText(18, 12, " " + vehicle.DyDyqrPhone); excel.SetCellText(20, 6, " " + comp.Name); excel.SetCellText(22, 6, " " + comp.Address); excel.SetCellText(24, 6, " " + comp.PostCode.Substring(0, 4) + "00"); excel.SetCellText(24, 12, " " + comp.Phone); excel.SetCellText(26, 6, " " + vehicle.DyJbrName); excel.SetCellText(26, 12, " " + vehicle.DyDldwPhone); GlobalPrintSetting printSetting = StaticCacheManager.GetConfig <GlobalPrintSetting>(); if (printSetting.PrintModel == "直接打") { excel.Print(); } else { excel.PrintPreview(); } excel.Close(); } else { MessageBoxHelper.Show("抵押登记主合同编号为空的时候不打印抵押登记表!"); } }
protected void PrintExcelF6() { GoldPrinter.ExcelAccess excel = new GoldPrinter.ExcelAccess(); string strExcelTemplateFile = Application.StartupPath + "/template/" + "注册登记表.xls"; excel.Open(strExcelTemplateFile); excel.IsVisibledExcel = false; // excel.SetCellText(5, 7, "R注册登记"); // excel.SetFont(5, 7, 5, 7, this.GouFont); excel.SetCellText(8, 7, " " + vehicle.TecZwpp + vehicle.TecClxh); excel.SetCellText(8, 21, " " + vehicle.TecClsbm); int row = 10, col = 7; switch (vehicle.XuGetFrom) { case "购买": row = 10; col = 7; break; case "境外自带": row = 10; col = 8; break; case "继承": row = 10; col = 10; break; case "赠予": row = 10; col = 14; break; case "协议抵偿债务": row = 10; col = 18; break; case "协议离婚": row = 10; col = 25; break; case "中奖": row = 10; col = 28; break; case "调拨": row = 11; col = 7; break; case "资产重组": row = 11; col = 8; break; case "资产整体买卖": row = 11; col = 10; break; case "仲裁裁决": row = 11; col = 18; break; case "法院调解": row = 11; col = 25; break; case "法院裁定": row = 11; col = 28; break; case "法院判决": row = 12; col = 7; break; case "其他": row = 12; col = 8; break; default: row = 10; col = 7; break; } excel.SetCellText(row, col, "R" + vehicle.XuGetFrom); excel.SetFont(row, col, row, col, this.GouFont); switch (vehicle.XuUseFor) { case "非营运": row = 14; col = 7; break; case "公路客运": row = 14; col = 8; break; case "公交客运": row = 14; col = 10; break; case "出租客运": row = 14; col = 15; break; case "旅游客运": row = 14; col = 21; break; case "租赁": row = 14; col = 27; break; case "教练": row = 14; col = 28; break; case "幼儿校车": row = 15; col = 7; break; case "小学生校车": row = 15; col = 8; break; case "其他校车": row = 15; col = 10; break; case "货运": row = 15; col = 15; break; case "危险化学品运输": row = 15; col = 21; break; case "警用": row = 15; col = 28; break; case "消防": row = 16; col = 7; break; case "救护": row = 16; col = 8; break; case "工程救险": row = 16; col = 10; break; case "营转非": row = 16; col = 15; break; case "出租营转非": row = 16; col = 21; break; default: row = 14; col = 7; break; } excel.SetCellText(row, col, "R" + vehicle.XuUseFor); //Microsoft.Office.Interop.Excel.Range rang=excel.GetRange(row, col); //rang.Font.Name = "wingdings 2"; excel.SetFont(row, col, row, col, this.GouFont); excel.SetCellText(17, 7, " " + vehicle.BaseSyrName); excel.SetCellText(18, 7, " " + vehicle.BaseSyrRegAddress); excel.SetCellText(19, 7, " " + vehicle.BaseSyrPostCode); excel.SetCellText(19, 11, " " + vehicle.BaseSyrPhone); excel.SetCellText(20, 7, " " + vehicle.BaseSyrEmail); excel.SetCellText(20, 11, " " + vehicle.BaseSyrMobile); excel.SetCellText(23, 7, " " + comp.Name); excel.SetCellText(25, 7, " " + comp.Address); excel.SetCellText(26, 7, " " + comp.PostCode.Substring(0, 4) + "00"); excel.SetCellText(26, 11, " " + comp.Phone); excel.SetCellText(27, 7, " " + comp.Email); excel.SetCellText(28, 7, " " + vehicle.BaseJbrName); excel.SetCellText(28, 11, " " + comp.Phone); GlobalPrintSetting printSetting = StaticCacheManager.GetConfig <GlobalPrintSetting>(); if (printSetting.PrintModel == "直接打") { excel.Print(); } else { //excel.SaveAs("c:\\测试打印表.xls", true); excel.PrintPreview(); } excel.Close(); }
protected void PrintExcelF7() { if (vehicle.DyHtzbh.Length > 0) { GoldPrinter.ExcelAccess excel = new GoldPrinter.ExcelAccess(); string strExcelTemplateFile = Application.StartupPath + "/template/" + "��Ѻ�ǼDZ�.xls"; excel.Open(strExcelTemplateFile); excel.IsVisibledExcel = false; //excel.SetCellText(5, 6, "R"+"��Ѻ�Ǽ� �������Ѻ�Ǽ� ����Ѻ �������Ѻ"); //excel.SetFont(5, 6, 5, 6, this.GouFont); excel.SetCellText(7, 6, " " + vehicle.BaseSyrName); excel.SetCellText(8, 6, " " + comp.Name); excel.SetCellText(10, 6, " " + comp.Address); excel.SetCellText(12, 6, " " + comp.PostCode.Substring(0, 4) + "00"); excel.SetCellText(12, 12, " " + comp.Phone); excel.SetCellText(13, 6, " " + comp.Email); excel.SetCellText(14, 6, " " + vehicle.BaseJbrName); excel.SetCellText(14, 12, " " + comp.Phone); excel.SetCellText(15, 6, " " + vehicle.DyDyqrName); excel.SetCellText(17, 6, " " + vehicle.DyDyqrConnAddress); excel.SetCellText(18, 6, " " + vehicle.DyDyqrPostCode); excel.SetCellText(18, 12, " " + vehicle.DyDyqrPhone); excel.SetCellText(20, 6, " " + comp.Name); excel.SetCellText(22, 6, " " + comp.Address); excel.SetCellText(24, 6, " " + comp.PostCode.Substring(0, 4) + "00"); excel.SetCellText(24, 12, " " + comp.Phone); excel.SetCellText(26, 6, " " + vehicle.DyJbrName); excel.SetCellText(26, 12, " " + vehicle.DyDldwPhone); GlobalPrintSetting printSetting = StaticCacheManager.GetConfig<GlobalPrintSetting>(); if (printSetting.PrintModel == "ֱ�Ӵ�") { excel.Print(); } else { excel.PrintPreview(); } excel.Close(); } else { MessageBoxHelper.Show("��Ѻ�Ǽ�����ͬ���Ϊ�յ�ʱ��ӡ��Ѻ�ǼDZ��"); } }
protected void PrintExcelF6() { GoldPrinter.ExcelAccess excel = new GoldPrinter.ExcelAccess(); string strExcelTemplateFile = Application.StartupPath + "/template/" + "ע��ǼDZ�.xls"; excel.Open(strExcelTemplateFile); excel.IsVisibledExcel = false; // excel.SetCellText(5, 7, "Rע��Ǽ�"); // excel.SetFont(5, 7, 5, 7, this.GouFont); excel.SetCellText(8, 7, " "+vehicle.TecZwpp+vehicle.TecClxh); excel.SetCellText(8, 21, " "+vehicle.TecClsbm); int row = 10, col = 7; switch(vehicle.XuGetFrom) { case "����": row = 10; col = 7; break; case "�����Դ�": row = 10; col = 8; break; case "�̳�": row = 10; col =10; break; case "����": row = 10; col =14; break; case "Э��ֳ�ծ��": row = 10; col =18; break; case "Э�����": row = 10; col =25; break; case "�н�": row = 10; col =28; break; case "����": row = 11; col =7; break; case "�ʲ�����": row = 11; col =8; break; case "�ʲ���������": row = 11; col =10; break; case "�ٲòþ�": row = 11; col =18; break; case "��Ժ����": row = 11; col =25; break; case "��Ժ�ö�": row = 11; col =28; break; case "��Ժ�о�": row = 12; col =7; break; case "����": row = 12; col =8; break; default: row = 10; col = 7; break; } excel.SetCellText(row, col, "R" + vehicle.XuGetFrom); excel.SetFont(row, col, row, col, this.GouFont); switch (vehicle.XuUseFor) { case "��Ӫ��": row = 14; col = 7; break; case "��·����": row = 14; col = 8; break; case "��������": row = 14; col = 10; break; case "�������": row = 14; col = 15; break; case "���ο���": row = 14; col = 21; break; case "����": row = 14; col = 27; break; case "����": row = 14; col = 28; break; case "��У��": row = 15; col = 7; break; case "Сѧ��У��": row = 15; col = 8; break; case "����У��": row = 15; col = 10; break; case "����": row = 15; col = 15; break; case "Σ�ջ�ѧƷ����": row = 15; col = 21; break; case "����": row = 15; col = 28; break; case "����": row = 16; col = 7; break; case "�Ȼ�": row = 16; col = 8; break; case "���̾���": row = 16; col =10; break; case "Ӫת��": row = 16; col =15; break; case "����Ӫת��": row = 16; col = 21; break; default: row = 14; col = 7; break; } excel.SetCellText(row, col, "R" + vehicle.XuUseFor); //Microsoft.Office.Interop.Excel.Range rang=excel.GetRange(row, col); //rang.Font.Name = "wingdings 2"; excel.SetFont(row, col, row, col, this.GouFont); excel.SetCellText(17, 7, " " + vehicle.BaseSyrName); excel.SetCellText(18, 7, " " + vehicle.BaseSyrRegAddress); excel.SetCellText(19, 7, " " + vehicle.BaseSyrPostCode); excel.SetCellText(19, 11, " " + vehicle.BaseSyrPhone); excel.SetCellText(20, 7, " " + vehicle.BaseSyrEmail); excel.SetCellText(20, 11, " " + vehicle.BaseSyrMobile); excel.SetCellText(23, 7, " " + comp.Name); excel.SetCellText(25, 7, " " + comp.Address); excel.SetCellText(26, 7, " " + comp.PostCode.Substring(0,4)+"00"); excel.SetCellText(26, 11, " " + comp.Phone); excel.SetCellText(27, 7, " " + comp.Email); excel.SetCellText(28, 7, " " + vehicle.BaseJbrName); excel.SetCellText(28, 11, " " + comp.Phone); GlobalPrintSetting printSetting = StaticCacheManager.GetConfig<GlobalPrintSetting>(); if (printSetting.PrintModel == "ֱ�Ӵ�") { excel.Print(); } else { //excel.SaveAs("c:\\���Դ�ӡ��.xls", true); excel.PrintPreview(); } excel.Close(); }
/// <summary> /// ֱ�Ӵ�ӡ /// </summary> public void PrintExcel(bool saveInk) { GoldPrinter.ExcelAccess excel = new GoldPrinter.ExcelAccess(); if (!saveInk) { string strExcelTemplateFile = Application.StartupPath + "/template/" + "��ʻ֤�����"; strExcelTemplateFile += "-" + this.Student.LearnType + ".xlt"; //System.IO.Path.GetFullPath(@"��ʻ֤�����.xlt"); excel.Open(strExcelTemplateFile); }//��ģ���ļ� else { string strExcelTemplateFile = Application.StartupPath + "/template/" + "�״�-��ʻ֤�����"; //System.IO.Path.GetFullPath(@"��ʻ֤�����.xlt"); strExcelTemplateFile += "-" + this.Student.LearnType + ".xlt"; excel.Open(strExcelTemplateFile); //excel.Open(); } excel.IsVisibledExcel = false; Code39 code39 = new Code39(); code39.WidthCU = 2; code39.LineHeight = 20; try { //SizeF titleSize = MyGraphics.MeasureString("1", code39.titleFont); code39.Height = code39.topHeight + code39.LineHeight + (int)20;//����ͼƬ�߶� Bitmap map = code39.CreateBarCode(Student.IdCard); string pathcode39 = Application.StartupPath + "/tempcode39.jpg"; ImageHelper.SaveCoderPic(map, pathcode39); // map.Save(pathcode39, System.Drawing.Imaging.ImageFormat.Jpeg); excel.InsertPicture(3, 1, pathcode39, 155, 26, 0); } catch (Exception ex) { //LogFactoryWrapper.Debug("����֤�������к��֣���֧��code39���룡"); } //excel.SetCellText(1, 24, 1, 30, "��У��" + Fm.Windows.Forms.CompanyInfoForm.Info.NickName); //excel.SetCellText(2, 24, 2, 30, "��У-" + Fm.Windows.Forms.CompanyInfoForm.Info.NickName); // excel.SetCellText(1, 1, " " + this.name); // excel.SetCellText(1, 20, " " + this.name); //excel.SetCellText(1, 21, " " + this.name); CompanyInfo comp = StaticCacheManager.GetConfig<CompanyInfo>(); excel.SetCellText(1, 22, "��У��" + comp.NickName); //excel.SetCellText(1, 23, " " + this.name); // excel.SetCellText(2, 24, 2, 30, " " + this.name); excel.SetCellText(4, 3, 4, 11, " " + Student.Name); excel.SetCellText(4, 14, 4, 15, Student.Sex); excel.SetCellText(4, 19, 4, 24, Student.Birthday); excel.SetCellText(4, 27, 4, 30, Student.Nation); excel.SetCellText(5, 3, 5, 4, Student.IdCardType); if (Student.IdCardType.Length < IdCardTypeMaxLen) { excel.SetFont(5, 3, 6, 4, new Font("����", 15f)); } for (int i = 0; i < Student.IdCard.Length; i++) { excel.SetCellText(5, 7 + i, Student.IdCard[i].ToString()); } if (Student.TempId.Length > 0) { excel.SetCellText(6, 3, 6, 4, "��ס֤"); for (int i = 0; i < Student.TempId.Length; i++) { excel.SetCellText(6, 7 + i, Student.TempId[i].ToString()); } } excel.SetCellText(7, 3, 7, 24, " " + Student.RegAddress); string connadd=this.GetConnAddress(); excel.SetCellText(8, 3, 8, 24, " " + connadd); if(connadd.Length<ConnAddressMaxLen) { excel.SetFont(8, 3, 8, 24, new Font("����", 15f)); } excel.SetCellText(9, 3, 9, 13, " " + Student.Phone); excel.SetCellText(9, 18, 9, 24, Student.PostCode); excel.SetCellText(10, 11, 10, 17,Student.NewCarType); DateTime regDate = System.DateTime.Now; if (AllPrinterConfig.GetPrinterConfig().ApplyConfig.PrintApplyDate) { excel.SetCellText(35, 25, 36, 30, regDate.Year + " �� " + regDate.Month + " �� " + regDate.Day + "��"); } string path = Application.StartupPath + "/temp.jpg"; if (Student.LearnType == "��ѧ") { if (AllPrinterConfig.GetPrinterConfig().ApplyConfig.Allow2Dimension) { //this.GetQRImage(Student.Dimension).Save(path, System.Drawing.Imaging.ImageFormat.Jpeg); ImageHelper.SaveCoderPic(this.GetQRImage(Student.Dimension), path); //excel.InsertPicture(25, 23, path, 110, 110, 5); excel.InsertPicture(27, 16, path, 100, 100, 5); } } else { excel.SetCellText(10, 25, 10, 30, Student.OldCarType); if (AllPrinterConfig.GetPrinterConfig().ApplyConfig.PrintProfile) { excel.SetCellText(3, 25, 3, 30, Student.Profile); } } /*if (this.LearnTypeString == "��ѧ") { if (!this.saveInk) { excel.SetCellText(10, 3, "����������"); } else { excel.SetCellText(10, 3, "��"); } } else { if (!this.saveInk) { excel.SetCellText(11, 3, "�������ݳ���"); } else { excel.SetCellText(11, 3, "��"); } excel.SetCellText(10, 25, 10, 30, this.HaveCarType); } */ GlobalPrintSetting printSetting = StaticCacheManager.GetConfig<GlobalPrintSetting>(); if (printSetting.PrintModel == "ֱ�Ӵ�") { excel.Print(); } else { excel.PrintPreview(); } excel.Close(); }
/// <summary> /// 直接打印 /// </summary> public void PrintExcel(bool saveInk) { GoldPrinter.ExcelAccess excel = new GoldPrinter.ExcelAccess(); if (!saveInk) { string strExcelTemplateFile = Application.StartupPath + "/template/" + "驾驶证申请表"; strExcelTemplateFile += "-" + this.Student.LearnType + ".xlt"; //System.IO.Path.GetFullPath(@"驾驶证申请表.xlt"); excel.Open(strExcelTemplateFile); }//用模板文件 else { string strExcelTemplateFile = Application.StartupPath + "/template/" + "套打-驾驶证申请表"; //System.IO.Path.GetFullPath(@"驾驶证申请表.xlt"); strExcelTemplateFile += "-" + this.Student.LearnType + ".xlt"; excel.Open(strExcelTemplateFile); //excel.Open(); } excel.IsVisibledExcel = false; Code39 code39 = new Code39(); code39.WidthCU = 2; code39.LineHeight = 20; try { //SizeF titleSize = MyGraphics.MeasureString("1", code39.titleFont); code39.Height = code39.topHeight + code39.LineHeight + (int)20;//定义图片高度 Bitmap map = code39.CreateBarCode(Student.IdCard); string pathcode39 = Application.StartupPath + "/tempcode39.jpg"; ImageHelper.SaveCoderPic(map, pathcode39); // map.Save(pathcode39, System.Drawing.Imaging.ImageFormat.Jpeg); excel.InsertPicture(3, 1, pathcode39, 155, 26, 0); } catch (Exception ex) { //LogFactoryWrapper.Debug("由于证件号码有汉字,不支持code39编码!"); } //excel.SetCellText(1, 24, 1, 30, "驾校:" + Fm.Windows.Forms.CompanyInfoForm.Info.NickName); //excel.SetCellText(2, 24, 2, 30, "驾校-" + Fm.Windows.Forms.CompanyInfoForm.Info.NickName); // excel.SetCellText(1, 1, " " + this.name); // excel.SetCellText(1, 20, " " + this.name); //excel.SetCellText(1, 21, " " + this.name); CompanyInfo comp = StaticCacheManager.GetConfig <CompanyInfo>(); excel.SetCellText(1, 22, "驾校:" + comp.NickName); //excel.SetCellText(1, 23, " " + this.name); // excel.SetCellText(2, 24, 2, 30, " " + this.name); excel.SetCellText(4, 3, 4, 11, " " + Student.Name); excel.SetCellText(4, 14, 4, 15, Student.Sex); excel.SetCellText(4, 19, 4, 24, Student.Birthday); excel.SetCellText(4, 27, 4, 30, Student.Nation); excel.SetCellText(5, 3, 5, 4, Student.IdCardType); if (Student.IdCardType.Length < IdCardTypeMaxLen) { excel.SetFont(5, 3, 6, 4, new Font("宋体", 15f)); } for (int i = 0; i < Student.IdCard.Length; i++) { excel.SetCellText(5, 7 + i, Student.IdCard[i].ToString()); } if (Student.TempId.Length > 0) { excel.SetCellText(6, 3, 6, 4, "暂住证"); for (int i = 0; i < Student.TempId.Length; i++) { excel.SetCellText(6, 7 + i, Student.TempId[i].ToString()); } } excel.SetCellText(7, 3, 7, 24, " " + Student.RegAddress); string connadd = this.GetConnAddress(); excel.SetCellText(8, 3, 8, 24, " " + connadd); if (connadd.Length < ConnAddressMaxLen) { excel.SetFont(8, 3, 8, 24, new Font("宋体", 15f)); } excel.SetCellText(9, 3, 9, 13, " " + Student.Phone); excel.SetCellText(9, 18, 9, 24, Student.PostCode); excel.SetCellText(10, 11, 10, 17, Student.NewCarType); DateTime regDate = System.DateTime.Now; if (AllPrinterConfig.GetPrinterConfig().ApplyConfig.PrintApplyDate) { excel.SetCellText(35, 25, 36, 30, regDate.Year + " 年 " + regDate.Month + " 月 " + regDate.Day + "日"); } string path = Application.StartupPath + "/temp.jpg"; if (Student.LearnType == "初学") { if (AllPrinterConfig.GetPrinterConfig().ApplyConfig.Allow2Dimension) { //this.GetQRImage(Student.Dimension).Save(path, System.Drawing.Imaging.ImageFormat.Jpeg); ImageHelper.SaveCoderPic(this.GetQRImage(Student.Dimension), path); //excel.InsertPicture(25, 23, path, 110, 110, 5); excel.InsertPicture(27, 16, path, 100, 100, 5); } } else { excel.SetCellText(10, 25, 10, 30, Student.OldCarType); if (AllPrinterConfig.GetPrinterConfig().ApplyConfig.PrintProfile) { excel.SetCellText(3, 25, 3, 30, Student.Profile); } } /*if (this.LearnTypeString == "初学") * { * if (!this.saveInk) * { * excel.SetCellText(10, 3, "□初次申领"); * } * else * { * excel.SetCellText(10, 3, "√"); * } * * } * else * { * if (!this.saveInk) * { * excel.SetCellText(11, 3, "□增加准驾车型"); * } * else * { * excel.SetCellText(11, 3, "√"); * } * excel.SetCellText(10, 25, 10, 30, this.HaveCarType); * } */ GlobalPrintSetting printSetting = StaticCacheManager.GetConfig <GlobalPrintSetting>(); if (printSetting.PrintModel == "直接打") { excel.Print(); } else { excel.PrintPreview(); } excel.Close(); }