Explorar o código

llllll

Signed-off-by: binren <zhangbr@elab-plus.com>
binren %!s(int64=4) %!d(string=hai) anos
pai
achega
0e47cf99fc
Modificáronse 1 ficheiros con 13 adicións e 13 borrados
  1. 13 13
      report_file_utils.py

+ 13 - 13
report_file_utils.py

@@ -92,17 +92,18 @@ class ReportFileUtils:
     def insert_cells(self, ws, data, start_row, start_col, end_col):
         if len(data) > 0:
             for index, v in enumerate(data):
-                y = 0
-                for col in range(start_col, end_col):
-                    value = v[y]
-                    if value is None:
-                        value = 0
-                    ws.col(col).width = 150 * 30  # 定义列宽
-                    style = self.simple_style if y >= 3 else self.default_style
-                    ws.write(start_row, col, value,
-                             style=style)
-                    y += 1
-                start_row += 1
+                if(len(v)) == 17:
+                    y = 0
+                    for col in range(start_col, end_col):
+                        value = v[y]
+                        if value is None:
+                            value = 0
+                        ws.col(col).width = 150 * 30  # 定义列宽
+                        style = self.simple_style if y >= 3 else self.default_style
+                        ws.write(start_row, col, value,
+                                 style=style)
+                        y += 1
+                    start_row += 1
 
     def horizontal_space_cells(self, ws, start_row, end_row, start_col, end_col):
         """
@@ -170,8 +171,7 @@ class ReportFileUtils:
 
             # 写入数据
             start_row = 1
-            if len(d) == len(header):
-                self.insert_cells(ws, d, start_row, 0, len(d[0]))
+            self.insert_cells(ws, d, start_row, 0, len(d[0]))
         self.wb.save(file_path)