Эх сурвалжийг харах

日期列显示,字体调整

callm 5 жил өмнө
parent
commit
9062a9f88b

+ 4 - 0
UAS-出货标签管理(贸易版)/ExportExcel.Designer.cs

@@ -75,6 +75,8 @@
             // CH_BLUEFILM
             // 
             this.CH_BLUEFILM.AutoSize = true;
+            this.CH_BLUEFILM.Checked = true;
+            this.CH_BLUEFILM.CheckState = System.Windows.Forms.CheckState.Checked;
             this.CH_BLUEFILM.Font = new System.Drawing.Font("宋体", 10F);
             this.CH_BLUEFILM.Location = new System.Drawing.Point(260, 116);
             this.CH_BLUEFILM.Margin = new System.Windows.Forms.Padding(4);
@@ -123,6 +125,8 @@
             // ch_code
             // 
             this.ch_code.AutoSize = true;
+            this.ch_code.Checked = true;
+            this.ch_code.CheckState = System.Windows.Forms.CheckState.Checked;
             this.ch_code.Font = new System.Drawing.Font("宋体", 10F);
             this.ch_code.Location = new System.Drawing.Point(488, 116);
             this.ch_code.Margin = new System.Windows.Forms.Padding(4);

+ 1 - 0
UAS-出货标签管理(贸易版)/ExportExcel.cs

@@ -185,6 +185,7 @@ namespace UAS_LabelMachine
                 if (i <= 4)
                 {
                     Controls["H_Param" + (i + 1)].Visible = true;
+                    ((CheckBox)Controls["H_Param" + (i + 1)]).Checked = true;
                     Controls["H_Param" + (i + 1)].Text = dt.Rows[i]["cep_name"].ToString();
                 }
             }

+ 0 - 1
UAS-出货标签管理(贸易版)/PublicMethod/DataHelper.cs

@@ -824,7 +824,6 @@ namespace UAS_LabelMachine
         {
             object result = null;
             command = new OracleCommand(SQL, connection);
-            //Console.WriteLine(SQL);
             //用来拼接参数的
             if (names.Length > 0)
             {

+ 18 - 13
UAS-出货标签管理(贸易版)/PublicMethod/ExcelHandler.cs

@@ -186,7 +186,7 @@ namespace UAS_LabelMachine
                 return null;
             }
         }
-        int RowHeight = 11;
+        int RowHeight = 12;
         /// <summary>
         /// 将DataTable形式的数据转成Excel格式的,然后用字节流的形式写入文件
         /// </summary>
@@ -278,22 +278,23 @@ namespace UAS_LabelMachine
             HSSFWorkbook book = new HSSFWorkbook();
             //Excel中的Sheet
             ISheet sheet = book.CreateSheet("分页");
-            sheet.SetMargin(MarginType.TopMargin, 0.5);
-            sheet.SetMargin(MarginType.BottomMargin, 0.5);
-            sheet.SetMargin(MarginType.LeftMargin, 0.5);
-            sheet.SetMargin(MarginType.RightMargin, 0.5);
+            sheet.SetMargin(MarginType.TopMargin, 0.4);
+            sheet.SetMargin(MarginType.BottomMargin, 0.4);
+            sheet.SetMargin(MarginType.LeftMargin, 0.4);
+            sheet.SetMargin(MarginType.RightMargin, 0.4);
             //芯片号需要作为更新盒号的条件
+            HSSFFont ffont = (HSSFFont)book.CreateFont();
+            ffont.FontName = "宋体";
             bool ShowChcode = true;
             //更新箱号
             List<string> pib_id = new List<string>();
             //系统打印箱号
             List<string> pib_outboxcode1 = new List<string>();
-
             int BoxCode = 1;
             ICellStyle style = book.CreateCellStyle();
             style.VerticalAlignment = VerticalAlignment.Center;
             style.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Left;
-
+            style.SetFont(ffont);
             ICellStyle styleborder = book.CreateCellStyle();
             styleborder.BorderBottom = NPOI.SS.UserModel.BorderStyle.Thin;
             styleborder.BorderTop = NPOI.SS.UserModel.BorderStyle.Thin;
@@ -301,6 +302,7 @@ namespace UAS_LabelMachine
             styleborder.BorderRight = NPOI.SS.UserModel.BorderStyle.Thin;
             styleborder.VerticalAlignment = VerticalAlignment.Center;
             styleborder.Alignment = NPOI.SS.UserModel.HorizontalAlignment.Left;
+            styleborder.SetFont(ffont);
             string pi_inoutno = "";
             //设置列的宽度,根据首行的列的内容的长度来设置
             for (int i = DataTable.Columns.Count - 1; i > 0; i--)
@@ -369,9 +371,12 @@ namespace UAS_LabelMachine
             //固定第一行
             //row.RowStyle.IsLocked=true;
             //给第一行的标签赋值样式和值
+            // ffont.FontHeight = 13;
             row.CreateCell(0);
-            row.Cells[0].SetCellValue("                     深爱半导体股份有限公司芯片出货清单");
-            row.GetCell(0).CellStyle = style;
+            row.Cells[0].SetCellValue("                                       深爱半导体股份有限公司芯片出货清单");
+
+            row.GetCell(0).CellStyle.SetFont((ffont));
+            //ffont.FontHeight = 10;
             //开始绘制的Index
             int PaintIndex = 1;
             int sumCount = 0;
@@ -464,7 +469,7 @@ namespace UAS_LabelMachine
                                         row1.CreateCell(j);
                                         row1.Cells[j].SetCellValue(DataTable.Rows[i]["pi_title"].ToString());
                                     }
-                                    else if (j > 5 && j == columnNum - 5)
+                                    else if (j == 4)
                                     {
                                         row1.CreateCell(j);
                                         row1.Cells[j].SetCellValue(DataTable.Rows[i]["pi_inoutno"].ToString());
@@ -490,7 +495,7 @@ namespace UAS_LabelMachine
                                         row1.CreateCell(j);
                                         row1.Cells[j].SetCellValue(DataTable.Rows[i]["pr_orispeccode"].ToString() + DataTable.Rows[i]["me_desc"].ToString() + DataTable.Rows[i]["pr_size"].ToString());
                                     }
-                                    else if (columnNum > 5 && j == columnNum - 5)
+                                    else if (j == 4)
                                     {
                                         row1.CreateCell(j);
                                         row1.Cells[j].SetCellValue(DataTable.Rows[i]["pi_date"].ToString());
@@ -622,7 +627,7 @@ namespace UAS_LabelMachine
                                 row1.Cells[j].CellStyle = style;
                             }
                             sheet.SetRowBreak(PaintIndex);
-                            sheet.Footer.Center ="第&P页,共&N页";
+                            sheet.Footer.Center = "第&P页,共&N页";
                             PaintIndex = PaintIndex + 1;
                         }
                         pib_id.Add(DataTable.Rows[i]["pib_id"].ToString());
@@ -1035,7 +1040,7 @@ namespace UAS_LabelMachine
             ISheet sheet2 = book.CreateSheet("首页");
             row = sheet2.CreateRow(0);
             row.CreateCell(0);
-            row.Cells[0].SetCellValue("                     深爱半导体股份有限公司芯片出货清单");
+            row.Cells[0].SetCellValue("                            深爱半导体股份有限公司芯片出货清单");
             row.GetCell(0).CellStyle = style;
             rowNum = FirstDT.Rows.Count;
             //不需要显示的列移除