feat: temp rm code

This commit is contained in:
zzs 2025-03-24 18:23:13 +08:00
parent d959e6fe14
commit f405fd3172

View File

@ -88,25 +88,25 @@ def QueryAll():
filtered_bookmarks = [bk_name for bk_name in bookmark_names if '_' not in bk_name and ':' not in bk_name] filtered_bookmarks = [bk_name for bk_name in bookmark_names if '_' not in bk_name and ':' not in bk_name]
result = {"text": [], "table": []} result = {"text": [], "table": []}
tables = doc.getTextTables() # tables = doc.getTextTables()
bookmark_in_table_position = QueryBookmarkPositionInTable(tables, bookmarks) # bookmark_in_table_position = QueryBookmarkPositionInTable(tables, bookmarks)
existing_table_indices = {} existing_table_indices = {}
for bk_name in filtered_bookmarks: for bk_name in filtered_bookmarks:
if bk_name in bookmark_in_table_position: # if bk_name in bookmark_in_table_position:
table_index = bookmark_in_table_position[bk_name]["tableIndex"] # table_index = bookmark_in_table_position[bk_name]["tableIndex"]
if table_index in existing_table_indices: # if table_index in existing_table_indices:
index = existing_table_indices[table_index] # index = existing_table_indices[table_index]
result["table"][index]["bookmark"].append(bk_name) # result["table"][index]["bookmark"].append(bk_name)
else: # else:
new_entry = {"tableIndex": table_index, "bookmark": [bk_name]} # new_entry = {"tableIndex": table_index, "bookmark": [bk_name]}
result["table"].append(new_entry) # result["table"].append(new_entry)
existing_table_indices[table_index] = ( # existing_table_indices[table_index] = (
len(result["table"]) - 1 # len(result["table"]) - 1
) # 更新索引记录 # ) # 更新索引记录
else: # else:
result["text"].append(bk_name) result["text"].append(bk_name)
return result return result
@ -247,6 +247,13 @@ def InsertRow(location_bookmark_name, data, start_row_index=-1):
raise RuntimeError(f"插入行时发生错误: {str(e)}") raise RuntimeError(f"插入行时发生错误: {str(e)}")
def InsertRowWithJSONDefineCol(json_str):
"""
插入行
"""
def DebugCallInsertRow(): def DebugCallInsertRow():
""" """
调试调用 调试调用