Browse Source

修改导出行数,行高调整

callm 5 years ago
parent
commit
c17acde360

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

@@ -186,7 +186,7 @@ namespace UAS_LabelMachine
                 return null;
             }
         }
-
+        int RowHeight = 11;
         /// <summary>
         /// 将DataTable形式的数据转成Excel格式的,然后用字节流的形式写入文件
         /// </summary>
@@ -384,7 +384,7 @@ namespace UAS_LabelMachine
             //冻结第一行
             sheet.CreateFreezePane(0, 1, 0, 1);
    
-            row.HeightInPoints = 20;
+            row.HeightInPoints = RowHeight;
             //固定第一行
             //row.RowStyle.IsLocked=true;
             //给第一行的标签赋值样式和值
@@ -409,7 +409,7 @@ namespace UAS_LabelMachine
                     {
                         IRow row1 = sheet.CreateRow(PaintIndex);
                         PaintIndex = PaintIndex + 1;
-                        row1.HeightInPoints = 20;
+                        row1.HeightInPoints = RowHeight;
                         //不包含的订单号
                         if (DataTable.Columns.Contains("pd_ordercode") && !First_OrderCode.Contains(DataTable.Rows[i]["pd_ordercode"].ToString()))
                         {
@@ -470,6 +470,7 @@ namespace UAS_LabelMachine
                             }
                             sumCount = 0;
                             row1 = sheet.CreateRow(PaintIndex);
+                            sheet.SetRowBreak(PaintIndex-1);
                             PaintIndex = PaintIndex + 1;
                         }
                         //每次到了页数开始分页
@@ -606,9 +607,7 @@ namespace UAS_LabelMachine
                                 }
                                 row1.Cells[j].CellStyle = styleborder;
                             }
-
                             row1 = sheet.CreateRow(PaintIndex);
-                            PaintIndex = PaintIndex + 1;
                             for (int j = 0; j < columnNum - 3; j++)
                             {
                                 if (j == 0)
@@ -643,6 +642,8 @@ namespace UAS_LabelMachine
                                 }
                                 row1.Cells[j].CellStyle = style;
                             }
+                            sheet.SetRowBreak(PaintIndex);
+                            PaintIndex = PaintIndex + 1;
                         }
                         ch_code.Add(DataTable.Rows[i]["ch_code"].ToString());
                         pib_outboxcode1.Add(BoxCode.ToString());
@@ -662,7 +663,7 @@ namespace UAS_LabelMachine
                     {
                         IRow row1 = sheet.CreateRow(PaintIndex);
                         PaintIndex = PaintIndex + 1;
-                        row1.HeightInPoints = 20;
+                        row1.HeightInPoints = RowHeight;
                         //如果批号不相等的时候
                         if (LastBatchCode != "" && LastBatchCode != DataTable.Rows[i]["ch_splitbatch"].ToString())
                         {
@@ -687,6 +688,7 @@ namespace UAS_LabelMachine
                             }
                             sumCount = 0;
                             row1 = sheet.CreateRow(PaintIndex);
+                            sheet.SetRowBreak(PaintIndex - 1);
                             PaintIndex = PaintIndex + 1;
                         }
                         //每次到了页数开始分页
@@ -802,7 +804,6 @@ namespace UAS_LabelMachine
                             }
                             //创建备注内容
                             row1 = sheet.CreateRow(PaintIndex);
-                            PaintIndex = PaintIndex + 1;
                             for (int j = 0; j < columnNum - 3; j++)
                             {
                                 if (j == 0)
@@ -836,6 +837,8 @@ namespace UAS_LabelMachine
                                 }
                                 row1.Cells[j].CellStyle = style;
                             }
+                            sheet.SetRowBreak(PaintIndex);
+                            PaintIndex = PaintIndex + 1;
                         }
                         ch_code.Add(DataTable.Rows[i]["ch_code"].ToString());
                         pib_outboxcode1.Add(BoxCode.ToString());
@@ -855,7 +858,7 @@ namespace UAS_LabelMachine
                     {
                         IRow row1 = sheet.CreateRow(PaintIndex);
                         PaintIndex = PaintIndex + 1;
-                        row1.HeightInPoints = 20;
+                        row1.HeightInPoints = RowHeight;
                         //如果批号不相等的时候
                         if (LastBoxCode != "" && LastBoxCode != DataTable.Rows[i]["CH_PBCODE"].ToString())
                         {
@@ -880,6 +883,7 @@ namespace UAS_LabelMachine
                             }
                             sumCount = 0;
                             row1 = sheet.CreateRow(PaintIndex);
+                            sheet.SetRowBreak(PaintIndex - 1);
                             PaintIndex = PaintIndex + 1;
                         }
                         //每次到了页数开始分页
@@ -1004,9 +1008,8 @@ namespace UAS_LabelMachine
                                 }
                                 row1.Cells[j].CellStyle = styleborder;
                             }
-
                             row1 = sheet.CreateRow(PaintIndex);
-                            PaintIndex = PaintIndex + 1;
+                   
                             for (int j = 0; j < columnNum - 3; j++)
                             {
                                 if (j == 0)
@@ -1040,6 +1043,8 @@ namespace UAS_LabelMachine
                                 }
                                 row1.Cells[j].CellStyle = style;
                             }
+                            sheet.SetRowBreak(PaintIndex);
+                            PaintIndex = PaintIndex + 1;
                         }
                         ch_code.Add(DataTable.Rows[i]["ch_code"].ToString());
                         pib_outboxcode1.Add(BoxCode.ToString());
@@ -1100,7 +1105,7 @@ namespace UAS_LabelMachine
             {
                 IRow row1 = sheet2.CreateRow(PaintIndex);
                 PaintIndex = PaintIndex + 1;
-                row1.HeightInPoints = 20;
+                row1.HeightInPoints = RowHeight;
                 //只需要绘制一行
                 if (i == 0)
                 {

+ 0 - 9
UAS-出货标签管理(贸易版)/UAS-出货标签管理(贸易版).csproj

@@ -737,15 +737,6 @@
     <None Include="Resources\preview_16px_25980_easyicon.net.png" />
   </ItemGroup>
   <ItemGroup>
-    <COMReference Include="BarTender">
-      <Guid>{D58562C1-E51B-11CF-8941-00A024A9083F}</Guid>
-      <VersionMajor>7</VersionMajor>
-      <VersionMinor>75</VersionMinor>
-      <Lcid>0</Lcid>
-      <WrapperTool>tlbimp</WrapperTool>
-      <Isolated>False</Isolated>
-      <EmbedInteropTypes>False</EmbedInteropTypes>
-    </COMReference>
     <COMReference Include="LabelManager2">
       <Guid>{3624B9C2-9E5D-11D3-A896-00C04F324E22}</Guid>
       <VersionMajor>6</VersionMajor>