csharp customer style print

/// <summary>
      /// 自定格式設置打印
      /// 塗聚文
      /// 締友計算機信息技術有限公司
      /// Geovin Du
      /// </summary>
      /// <param name="sender"></param>
      /// <param name="e"></param>
      private void printDocument1_PrintPage(object sender, PrintPageEventArgs e)
      {
          try
          { 

              // printDocument1.DefaultPageSettings.Landscape = true; //橫向打印 

              //if (File.Exists(path + "\\2.png"))
              //{
              //    File.Delete(path + "\\2.png");
              //    GC.Collect();
              //}
              //1
              Pdf417lib pft417 = new Pdf417lib();
              Bitmap bit;
              bit = Pdf417lib.GenerateBitmap("ABCDEFGHIJKLMNOPQRSTUVWXYZ", 90, 30);
              pft417.Options = Pdf417lib.PDF417_INVERT_BITMAP;
              pft417.paintCode(); 

              //bit.Save(path + "\\2.png");
              //im = Image.FromFile(path + "\\2.png");
              im = Image.FromHbitmap(bit.GetHbitmap()); 

              //2
              //Image qrbit;
              //Bitmap qrb;
              //QRCode barcode = new QRCode();
              //barcode.Code = "362425";
              //barcode.BarcodeWidth = 50;
              //barcode.BarcodeHeight = 50;
              //barcode.drawBarcode2ImageFile(path + "\\3.png");
              //qrb=barcode.drawBarcodeOnBitmap();
              //qrbit = Image.FromFile(path + "\\3.png");
              //3
              QRCodeEncoder qrCodeEncoder = new QRCodeEncoder(); 

              String encoding = "362425L00093";
              qrCodeEncoder.QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.ALPHA_NUMERIC;
              int scale = 4;
              qrCodeEncoder.QRCodeScale = scale;
              int version = 4;
              qrCodeEncoder.QRCodeVersion = version;
              qrCodeEncoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.M;
              System.Drawing.Image image;
              String data = encoding;
              image = qrCodeEncoder.Encode(data);
              //image.Save(path+"\\geovindu.png",System.Drawing.Imaging.ImageFormat.Png); 

              string imagePath = path + "\\1.png";
              Image temp = Image.FromFile(imagePath);
              int printWidth = e.PageBounds.Width;//页面宽度 827* 1169 英寸
              int printHeight = e.PageBounds.Height;//页面高度1169
              int left = 15;//printWidth / 2 -
              int right = printWidth / 2 + 15;//
              int top = 10;//printHeight / 2 -
              Brush myBrush = new SolidBrush(System.Drawing.Color.Black);//创建Brush对象
              Pen mypen = new Pen(System.Drawing.Color.Black);//创建Pen对象
              Font myFont = new Font("宋体", 10);//创建Font对象
              Font headFont = new Font("宋体", 8);
              Font conFont = new Font("宋体", 7);
              //Rectangle destRect = new Rectangle(right + 280, top - 5, 50, 50); //80, 20
              Rectangle destRect = new Rectangle(right + 280, top - 5, 90, 30);
              e.Graphics.DrawImage(im, destRect, 0, 0, im.Width, im.Height, System.Drawing.GraphicsUnit.Pixel);//圖片image
              e.Graphics.DrawString("締友計算機信息技術(深圳)有限公司" + DateTime.Now.Year.ToString() + "年" + (DateTime.Now.Month - 1).ToString() + "月份工資单", new Font("宋体", 10, FontStyle.Bold), myBrush, new Point(32, top));//绘制标题
              e.Graphics.DrawLine(new Pen(System.Drawing.Color.Black, 2), 32, top + 20, 680, top + 20);//绘制线条
              #region
              //e.Graphics.DrawRectangle(mypen, left, top + 62, 810, 230);//绘制矩形框
              //e.Graphics.DrawLine(mypen, left + 50, top + 62, left + 50, top + 293);//绘制第一列网格线
              //e.Graphics.DrawLine(mypen, left + 80, top + 62, left + 80, top + 293);//绘制第二列网格线
              //e.Graphics.DrawLine(mypen, left + 180, top + 62, left + 180, top + 293);//绘制第四列网格线
              //e.Graphics.DrawLine(mypen, left + 80, top + 122, left + 180, top + 122);//绘制第二行网格线
              //e.Graphics.DrawLine(mypen, left + 130, top + 122, left + 130, top + 293);//绘制第三列网格线
              //e.Graphics.DrawLine(mypen, left + 240, top + 62, left + 240, top + 293);//绘制第五列网格线
              //e.Graphics.DrawLine(mypen, left + 290, top + 62, left + 290, top + 293);//绘制第六列网格线
              //e.Graphics.DrawLine(mypen, left + 290, top + 122, left + 440, top + 122);//绘制第二行网格线
              //e.Graphics.DrawLine(mypen, left + 340, top + 122, left + 340, top + 293);//绘制第七列网格线
              //e.Graphics.DrawLine(mypen, left + 390, top + 122, left + 390, top + 293);//绘制第八列网格线
              //e.Graphics.DrawLine(mypen, left + 440, top + 62, left + 440, top + 293);//绘制第九列网格线
              //e.Graphics.DrawLine(mypen, left + 490, top + 62, left + 490, top + 293);//绘制第10列网格线
              //e.Graphics.DrawLine(mypen, left + 540, top + 62, left + 540, top + 293);//绘制第11列网格线
              //e.Graphics.DrawLine(mypen, left + 590, top + 62, left + 590, top + 293);//绘制第12列网格线
              //e.Graphics.DrawLine(mypen, left + 640, top + 62, left + 640, top + 293);//绘制第13列网格线
              //e.Graphics.DrawLine(mypen, left + 640, top + 122, left + 740, top + 122);//绘制第二行网格线
              //e.Graphics.DrawLine(mypen, left + 690, top + 122, left + 690, top + 293);//绘制第14列网格线
              //e.Graphics.DrawLine(mypen, left + 740, top + 62, left + 740, top + 293);//绘制第15列网格线
              //e.Graphics.DrawLine(mypen, left, top + 182, 825, top + 182);//绘制第三行网格线 

              ////绘制第1行数据
              //e.Graphics.DrawString("姓名", headFont, myBrush, new Point(left, top + 65));
              //e.Graphics.DrawString(strName, conFont, myBrush, new Point(left, top + 185));
              #endregion 

              //繪制第一個表格(10列3行)
              e.Graphics.DrawRectangle(mypen, left, top + 50, 780, 125);//绘制矩形框
              int k1 = (int)((19 * 100) / 25.4 + 1);
              int k2 = (int)((14.8 * 100) / 25.4 + 1);
              int t1 = (int)((10 * 100) / 25.4 + 1);
              int t2 = (int)((11 * 100) / 25.4 + 1); 

              e.Graphics.DrawLine(mypen, left + k1, top + 50, left + k1, top + 175);//绘制第1列网格线
              e.Graphics.DrawLine(mypen, left + k1 * 2, top + 50, left + k1 * 2, top + 175);//绘制第2列网格线
              e.Graphics.DrawLine(mypen, left + k1 * 3, top + 50, left + k1 * 3, top + 175);//绘制第3列网格线
              e.Graphics.DrawLine(mypen, left + k1 * 4, top + 50 + t1, left + k1 * 4, top + 175);//绘制第4列网格线
              e.Graphics.DrawLine(mypen, left + k1 * 5, top + 50, left + k1 * 5, top + 175);//绘制第5列网格线
              e.Graphics.DrawLine(mypen, left + k1 * 3, top + 50 + t1, left + k1 * 5, top + 50 + t1);//绘制第1行网格线
              e.Graphics.DrawLine(mypen, left + k1 * 6, top + 50, left + k1 * 6, top + 175);//绘制第6列网格线
              e.Graphics.DrawLine(mypen, left, top + 50 + t1 + t2, 795, top + 50 + t1 + t2);//绘制第2行网格线
              e.Graphics.DrawLine(mypen, left + k1 * 7, top + 50, left + k1 * 7, top + 175);//绘制第7列网格线
              e.Graphics.DrawLine(mypen, left + k1 * 8, top + 50 + t1, left + k1 * 8, top + 175);//绘制第8列网格线
              e.Graphics.DrawLine(mypen, left + k1 * 9, top + 50 + t1, left + k1 * 9, top + 175);//绘制第9列网格线
              e.Graphics.DrawLine(mypen, left + k1 * 7, top + 50 + t1, 795, top + 50 + t1);//绘制第2行网格线
              //第一個標題列
              e.Graphics.DrawString("工號", headFont, myBrush, new Point(left + 15, top + 85));
              e.Graphics.DrawString(strNo, conFont, myBrush, new Point(left + 15, top + t1 + t2 + 65));
              e.Graphics.DrawString("姓名", headFont, myBrush, new Point(left + k1 + 15, top + 85));
              e.Graphics.DrawString(strName, conFont, myBrush, new Point(left + k1 + 15, top + t1 + t2 + 65));
              e.Graphics.DrawString("戶藉", headFont, myBrush, new Point(left + k1 * 2 + 15, top + 85));
              e.Graphics.DrawString(strNation, conFont, myBrush, new Point(left + k1 * 2 + 15, top + t1 + t2 + 65));
              e.Graphics.DrawString("正常工作時間工資", headFont, myBrush, new Point(left + k1 * 3 + 15, top + 65)); 

              e.Graphics.DrawString("基本薪金", headFont, myBrush, new Point(left + k1 * 3 + 15, top + t1 + 65));
              e.Graphics.DrawString(strBasicSalary, conFont, myBrush, new Point(left + k1 * 3 + 15, top + t1 + t2 + 65));
              e.Graphics.DrawString("崗位工資", headFont, myBrush, new Point(left + k1 * 4 + 15, top + t1 + 65));
              e.Graphics.DrawString(strJobSalary, conFont, myBrush, new Point(left + k1 * 4 + 15, top + t1 + t2 + 65));
              e.Graphics.DrawString("正常上班", headFont, myBrush, new Point(left + k1 * 5 + 15, top + 65));
              e.Graphics.DrawString("天數(天)", headFont, myBrush, new Point(left + k1 * 5 + 15, top + t1 + 65));
              e.Graphics.DrawString(WorkNumberDay, conFont, myBrush, new Point(left + k1 * 5 + 15, top + t1 + t2 + 65));
              e.Graphics.DrawString("加班時間", headFont, myBrush, new Point(left + k1 * 6 + 15, top + 65));
              e.Graphics.DrawString("天數(天)", headFont, myBrush, new Point(left + k1 * 6 + 15, top + t1 + 65));
              e.Graphics.DrawString(OverNumberDay, conFont, myBrush, new Point(left + k1 * 6 + 15, top + t1 + t2 + 65));
              e.Graphics.DrawString("加班費", headFont, myBrush, new Point(left + k1 * 7 + 15, top + t1 + 65));
              e.Graphics.DrawString(OverDuty, conFont, myBrush, new Point(left + k1 * 7 + 15, top + t1 + t2 + 65));
              e.Graphics.DrawString("浮動津貼", headFont, myBrush, new Point(left + k1 * 8 + 15, top + t1 + 65));
              e.Graphics.DrawString(WorkSalary, conFont, myBrush, new Point(left + k1 * 8 + 15, top + t1 + t2 + 65));
              e.Graphics.DrawString("總月薪", headFont, myBrush, new Point(left + k1 * 9 + 15, top + t1 + 65));
              e.Graphics.DrawString(TotalSalary, conFont, myBrush, new Point(left + k1 * 9 + 15, top + t1 + t2 + 65));
              //繪制第二個表格12列3行)
              e.Graphics.DrawRectangle(mypen, left, top + 200, 780, 125);//绘制矩形框
              e.Graphics.DrawLine(mypen, left + k2, top + 200, left + k2, top + 325);//绘制第1列网格线
              e.Graphics.DrawLine(mypen, left + k2 * 2, top + 200, left + k2 * 2, top + 325);//绘制第2列网格线
              e.Graphics.DrawLine(mypen, left + k2 * 3, top + 200, left + k2 * 3, top + 325);//绘制第3列网格线
              e.Graphics.DrawLine(mypen, left + k2 * 4, top + 200, left + k2 * 4, top + 325);//绘制第4列网格线
              e.Graphics.DrawLine(mypen, left + k2 * 5, top + 200, left + k2 * 5, top + 325);//绘制第5列网格线
              e.Graphics.DrawLine(mypen, left + k2 * 6, top + 200 + t1, left + k2 * 6, top + 325);//绘制第6列网格线
              e.Graphics.DrawLine(mypen, left + k2 * 7, top + 200, left + k2 * 7, top + 325);//绘制第7列网格线
              e.Graphics.DrawLine(mypen, left + k2 * 8, top + 200, left + k2 * 8, top + 325);//绘制第8列网格线
              e.Graphics.DrawLine(mypen, left + k2 * 5, top + 200 + t1, left + k2 * 7, top + 200 + t1);//绘制第1行网格线
              e.Graphics.DrawLine(mypen, left + k2 * 9, top + 200 + t1, left + k2 * 9, top + 325);//绘制第9列网格线
              e.Graphics.DrawLine(mypen, left + k2 * 10, top + 200 + t1, left + k2 * 10, top + 325);//绘制第10列网格线
              e.Graphics.DrawLine(mypen, left + k2 * 11, top + 200 + t1, left + k2 * 11, top + 325);//绘制第11列网格线
              e.Graphics.DrawLine(mypen, left + k2 * 12, top + 200, left + k2 * 12, top + 325);//绘制第12列网格线
              e.Graphics.DrawLine(mypen, left + k2 * 8, top + 200 + t1, left + k2 * 12, top + 200 + t1);//绘制第1行网格线
              e.Graphics.DrawLine(mypen, left, top + 200 + t1 + t2, 795, top + 200 + t1 + t2);//绘制第2行网格线 

              //第二個表標題 backNumberDay
              e.Graphics.DrawString("缺勤天", headFont, myBrush, new Point(left + 10, top + 200 + 15));
              e.Graphics.DrawString("數(天)", headFont, myBrush, new Point(left + 10, top + 200 + t1 + 15));
              e.Graphics.DrawString(backNumberDay, conFont, myBrush, new Point(left + 10, top + 200 + t1 + t2 + 15));
              e.Graphics.DrawString("加點時", headFont, myBrush, new Point(left + k2 + 10, top + 200 + 15));
              e.Graphics.DrawString("時(小時)", headFont, myBrush, new Point(left + k2 + 10, top + 200 + t1 + 15));//加班時間(小時)
              e.Graphics.DrawString(OverTime, conFont, myBrush, new Point(left + k2 + 10, top + 200 + t1 + t2 + 15)); 

              e.Graphics.DrawString("加班時", headFont, myBrush, new Point(left + k2 * 2 + 10, top + 200 + 15));
              e.Graphics.DrawString("時(小時)", headFont, myBrush, new Point(left + k2 * 2 + 10, top + 200 + t1 + 15)); 

              e.Graphics.DrawString("法定假加", headFont, myBrush, new Point(left + k2 * 3 + 10, top + 200 + 15));
              e.Graphics.DrawString("班(小時)", headFont, myBrush, new Point(left + k2 * 3 + 10, top + 200 + t1 + 15));
              e.Graphics.DrawString(OverLawTime, conFont, myBrush, new Point(left + k2 * 3 + 10, top + 200 + t1 + t2 + 15)); 

              e.Graphics.DrawString("缺勤扣除", headFont, myBrush, new Point(left + k2 * 4 + 10, top + 200 + 15));
              e.Graphics.DrawString("/補年假", headFont, myBrush, new Point(left + k2 * 4 + 10, top + 200 + t1 + 15));
              e.Graphics.DrawString(PublicTime, conFont, myBrush, new Point(left + k2 * 4 + 10, top + 200 + t1 + t2 + 15)); 

              e.Graphics.DrawString("社會保險除扣除", headFont, myBrush, new Point(left + k2 * 5 + 10, top + 200 + 15));
              e.Graphics.DrawString("養老保", headFont, myBrush, new Point(left + k2 * 5 + 10, top + 200 + t1 + 5));
              e.Graphics.DrawString("險(8%)", headFont, myBrush, new Point(left + k2 * 5 + 10, top + 200 + t1 + 20));
              e.Graphics.DrawString(WelfareFund, conFont, myBrush, new Point(left + k2 * 5 + 10, top + 200 + t1 + t2 + 15)); 

              e.Graphics.DrawString("醫保", headFont, myBrush, new Point(left + k2 * 6 + 10, top + 200 + t1 + 15));
              e.Graphics.DrawString(MedicalInsurance, conFont, myBrush, new Point(left + k2 * 6 + 10, top + 200 + t1 + t2 + 15)); 

              e.Graphics.DrawString("住房公", headFont, myBrush, new Point(left + k2 * 7 + 10, top + 200 + 15));
              e.Graphics.DrawString("金扣除", headFont, myBrush, new Point(left + k2 * 7 + 10, top + 200 + t1));
              e.Graphics.DrawString("(5%)", headFont, myBrush, new Point(left + k2 * 7 + 10, top + 200 + t1 + 20));
              e.Graphics.DrawString(HousingFund, conFont, myBrush, new Point(left + k2 * 7 + 10, top + 200 + t1 + t2 + 15)); 

              e.Graphics.DrawString("個稅扣除", headFont, myBrush, new Point(left + k2 * 8 + 30, top + 200 + 15));
              e.Graphics.DrawString("交稅基數", headFont, myBrush, new Point(left + k2 * 8 + 10, top + 200 + t1 + 15));
              e.Graphics.DrawString(HousingFund, conFont, myBrush, new Point(left + k2 * 8 + 10, top + 200 + t1 + t2 + 15)); 

              e.Graphics.DrawString("稅率", headFont, myBrush, new Point(left + k2 * 9 + 10, top + 200 + t1 + 15));
              e.Graphics.DrawString(strTax, conFont, myBrush, new Point(left + k2 * 9 + 10, top + 200 + t1 + t2 + 15)); 

              e.Graphics.DrawString("扣除數", headFont, myBrush, new Point(left + k2 * 10 + 10, top + 200 + t1 + 15));
              e.Graphics.DrawString(strClerkSalary, conFont, myBrush, new Point(left + k2 * 10 + 10, top + 200 + t1 + t2 + 15)); 

              e.Graphics.DrawString("代扣個稅", headFont, myBrush, new Point(left + k2 * 11 + 10, top + 200 + t1 + 15));
              e.Graphics.DrawString(strClerkSalary, conFont, myBrush, new Point(left + k2 * 11 + 10, top + 200 + t1 + t2 + 15)); 

              e.Graphics.DrawString("實發工資", headFont, myBrush, new Point(left + k2 * 12 + 10, top + 200 + 25));
              e.Graphics.DrawString(strSalary, conFont, myBrush, new Point(left + k2 * 12 + 10, top + 200 + t1 + t2 + 15)); 

              //bottom
              e.Graphics.DrawString("發薪日期:" + DateTime.Now.ToLongDateString(), new Font("宋体", 7), myBrush, new Point(right + 150, top + 330)); 

          }
          catch (DirectoryNotFoundException ex)
          {
              ex.Message.ToString();
          } 

      }
      /// <summary>
      /// 打印
      /// 塗聚文
      /// 締友計算機信息技術有限公司
      /// Geovin Du
      /// </summary>
      /// <param name="sender"></param>
      /// <param name="e"></param>
      private void button1_Click(object sender, EventArgs e)
      { 

          //A4紙:页面宽度 827* 1169 (英寸),210*297(毫米)
          //自定義紙張大小 PaperSize   pkCustomSize   =   new   PaperSize( "custom   size",(int)(82.55*100/25.4+1),(int)(184.0*100/25.4+1)); //毫米轉英寸
          PaperSize pkCustomSize = new PaperSize("Custum", (int)(216 * 100 / 25.4 + 1), (int)(97 * 100 / 25.4 + 1)); //六福的工資單規格
          this.printDocument1.DefaultPageSettings.PaperSize = pkCustomSize;
          int width = (int)(216 * 100 / 25.4 + 1);
          int height = (int)(97 * 100 / 25.4 + 1);
          //this.printDocument1.DefaultPageSettings.PaperSize.Height = height;
          //this.printDocument1.DefaultPageSettings.PaperSize.Width = width;
          //PageSettings storePageSetting = new PageSettings();//实列化一个对PageSettings对象
          //foreach (PaperSize ps in printDocument1.PrinterSettings.PaperSizes)//查找当前设置纸张
          //{
          //    if (paperName == ps.PaperName)
          //    {
          //        storePageSetting.PaperSize = ps;
          //        break;
          //    }
          //}
          foreach (PaperSize paperSize in printDocument1.PrinterSettings.PaperSizes)
          {
              if (paperSize.PaperName == "Custum" && paperSize.Height == width && paperSize.Height == height)
              { 

                  printDocument1.DefaultPageSettings.PaperSize = paperSize;
                  break;
              }
          }
          printDocument1.DefaultPageSettings.Landscape = false;//
          //this.printDocument1.DefaultPageSettings.PaperSize = new PaperSize("Custum", 500, 300); 

         printPreviewDialog1.ShowDialog();
      }
时间: 2024-10-30 16:58:35

csharp customer style print的相关文章

符合标准的网站页面的头文件

标准|页面 在做的时候可以具体的参考一下....网页设计师 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN"

JavaScript+CSS控制打印格式示例介绍

 1. 用media="print"的css来控制要打印的文件testPrint.html中引用media为print的样式,表示打印时该样式才起作用  代码如下: <link href="/style/print.css" rel="stylesheet" type="text/css" media="print">    /style/print.css文件   代码如下: .noprint

代码重构(六):代码重构完整案例

无论做什么事情呢,都要善始善终呢.前边连续发表了5篇关于重构的博客,其中分门别类的介绍了一些重构手法.今天的这篇博客就使用一个完整的示例来总结一下之前的重构规则,也算给之前的关于重构的博客画一个句号.今天的示例借鉴于<重构,改善既有代码的设计>这本书中的第一章的示例,在其基础上做了一些修改.今天博客从头到尾就是一个完整的重构过程.首先会给出需要重构的代码,然后对其进行分析,然后对症下药,使用之前我们分享的重构规则对其进行一步步的重构. 先来聊一下该示例的使用场景(如果你有重构这本书的话,可以参

C# 下载带进度条代码(普通进度条)

<span style="font-size:14px;"> </span><pre name="code" class="csharp"><span style="font-size:14px;"> /// <summary> /// 下载带进度条代码(普通进度条) /// </summary> /// <param name="URL&

学习设计模式之初,面向对象再理解

要开始大话设计模式的学习了,看这本书的封面,感觉很轻松,很卡通,很有趣.一本新书怎么去读,怎么去学,老师讲过很多次了. 一本书的前言是相当重要,它能帮助我们掌握全局,它也可能会给予我们一些指导.读完前言,我便知道自己下一步该做什么了. 下一个脚步--面向对象再理解. 关于面向对象,在学习C#的时候有了初步总结,但感觉很多概念理解得都不是很深刻.所以,在学习设计模式之初,很有必要再次进行总结. 从设计模式这本书中,故事性.提问性.交谈性的编写方式,读起来的感觉真的不太一样,没有那么枯燥,硬邦邦的感

自动生成数据库字典(sql2008)

每次做项目的时候都要做数据字典,这种重复的工作实在很是痛苦,于是广找资料,终于完成了自动生成数据库字典的工作,废话少说,上代码. 存储过程: SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author:        <Carbe> -- Create date: <2014-09-19> -- Description:    

Swift内存管理(ARC)

原文出自:Swift ARC总结 引言 Swift使用自动引用计数(ARC)机制来处理内存.通常情况下,Swift内存管理机制会自动管理内存,无须我们考虑内存的管理.ARC会在类的实例不再被使用(也就是没有引用)时,会自动释放其占用的内存. 可是,在少数情况下,ARC需要更多地了解我们代码之间的联系,才能正确管理内存.本篇文章就这少数情况而讨论和分析其应用场景及如何更好地解决循环引用的问题. 注意:ARC仅应用于类的实例.结构体和枚举类型是值类型,不是引用类型,也不是通过引用的方式存储和传递.

JavaScript+CSS控制打印格式示例介绍_javascript技巧

1. 用media="print"的css来控制要打印的文件testPrint.html中引用media为print的样式,表示打印时该样式才起作用 复制代码 代码如下: <link href="/style/print.css" rel="stylesheet" type="text/css" media="print"> /style/print.css文件 复制代码 代码如下: .nopr

Linux下将excel数据导入到mssql数据库中的方法_php实例

先清理一下思路先,~~ 首先:需要把文件上传到服务器上 然后:读取excel数据列显示出来 然后:让用户选择字段的对应关系 然后:提交数据,读取字段的对应关系 最后:批量导入数据,删除临时文件 一共是以上五步骤!我们一步步分析~~~ 第一步:下载附件中的phpexcelparser4.rar ,这个文件是上传excel盗服务器上并以web形式展示出来的!这个一般没有问题的!问题是程序的做法是把表存为临时表而没有真正保存下来,所以首先要更改程序代码为 复制代码 代码如下: if (trim($_P