fix: 让采样点占比整列显示为百分比

This commit is contained in:
2026-11-13 15:45:39 +08:00
parent d2e52e7105
commit 180ff5030d
+3 -2
View File
@@ -384,8 +384,9 @@ def write_book(path, frames):
sheet = writer.sheets[name]
percent = [index for index, column in enumerate(frame.columns, 1) if str(column).endswith("移动采样点占比")]
for column in percent:
for cell in sheet.iter_cols(min_col=column, max_col=column, min_row=2, max_row=sheet.max_row):
cell[0].number_format = "0.00%"
for cells in sheet.iter_cols(min_col=column, max_col=column, min_row=2, max_row=sheet.max_row):
for cell in cells:
cell.number_format = "0.00%"
for cell in sheet[1]:
sheet.column_dimensions[cell.column_letter].width = max(12, len(str(cell.value)) * 2 + 2)
sheet.freeze_panes = "C2"