添加单元格合并异常处理逻辑
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2025 Jeffrey Hsu - JITToolBox
|
# Copyright (c) 2025-2026 Jeffrey Hsu - JITToolBox
|
||||||
# #
|
# #
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -155,9 +155,13 @@ class DocxWriter:
|
|||||||
for performance in self.excel_reader.achievement_level[r_index]:
|
for performance in self.excel_reader.achievement_level[r_index]:
|
||||||
non_none_count = 3 - performance.scores.count(None)
|
non_none_count = 3 - performance.scores.count(None)
|
||||||
if non_none_count > 1:
|
if non_none_count > 1:
|
||||||
|
try:
|
||||||
cell_start = table.cell(row, col_span)
|
cell_start = table.cell(row, col_span)
|
||||||
cell_end = table.cell(row, col_span + non_none_count - 1)
|
cell_end = table.cell(row, col_span + non_none_count - 1)
|
||||||
cell_start.merge(cell_end)
|
cell_start.merge(cell_end)
|
||||||
|
except IndexError:
|
||||||
|
self.signal(f"单元格合并失败:({row}, {col_span}),需要自行检查表格准确性",
|
||||||
|
LOGLEVEL.WARNING)
|
||||||
col_span += non_none_count
|
col_span += non_none_count
|
||||||
|
|
||||||
start = rows - X + 3 + self.excel_reader.kpi_number
|
start = rows - X + 3 + self.excel_reader.kpi_number
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
# Copyright (c) 2025 Jeffrey Hsu - JITToolBox
|
# Copyright (c) 2025-2026 Jeffrey Hsu - JITToolBox
|
||||||
# #
|
# #
|
||||||
# This program is free software: you can redistribute it and/or modify
|
# This program is free software: you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
@@ -20,7 +20,7 @@ from typing import Callable, Literal
|
|||||||
from PySide6.QtCore import Qt, Signal, QThread
|
from PySide6.QtCore import Qt, Signal, QThread
|
||||||
from PySide6.QtWidgets import QVBoxLayout, QFileDialog, QHBoxLayout
|
from PySide6.QtWidgets import QVBoxLayout, QFileDialog, QHBoxLayout
|
||||||
from qfluentwidgets import GroupHeaderCardWidget, FluentIcon, PushButton, LineEdit, IconWidget, BodyLabel, \
|
from qfluentwidgets import GroupHeaderCardWidget, FluentIcon, PushButton, LineEdit, IconWidget, BodyLabel, \
|
||||||
PrimaryPushButton, SwitchButton, HyperlinkButton
|
PrimaryPushButton, SwitchButton, HyperlinkButton, InfoBar, InfoBarPosition
|
||||||
|
|
||||||
from module import LOGLEVEL
|
from module import LOGLEVEL
|
||||||
from module.worker import ARGWorker
|
from module.worker import ARGWorker
|
||||||
@@ -259,3 +259,13 @@ class AchievementWidget(Widget):
|
|||||||
def show_info(self, content: str, level: str):
|
def show_info(self, content: str, level: str):
|
||||||
if level == LOGLEVEL.INFO:
|
if level == LOGLEVEL.INFO:
|
||||||
self.pib.set_title(content)
|
self.pib.set_title(content)
|
||||||
|
elif level == LOGLEVEL.WARNING:
|
||||||
|
InfoBar.warning(
|
||||||
|
title='提示',
|
||||||
|
content=content,
|
||||||
|
orient=Qt.Horizontal,
|
||||||
|
isClosable=True,
|
||||||
|
position=InfoBarPosition.TOP_RIGHT,
|
||||||
|
duration=5000,
|
||||||
|
parent=self
|
||||||
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user