diff --git a/BookmarkOP.py b/BookmarkOP.py index ecabe08..ef8edb1 100644 --- a/BookmarkOP.py +++ b/BookmarkOP.py @@ -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] result = {"text": [], "table": []} - tables = doc.getTextTables() - bookmark_in_table_position = QueryBookmarkPositionInTable(tables, bookmarks) + # tables = doc.getTextTables() + # bookmark_in_table_position = QueryBookmarkPositionInTable(tables, bookmarks) existing_table_indices = {} for bk_name in filtered_bookmarks: - if bk_name in bookmark_in_table_position: - table_index = bookmark_in_table_position[bk_name]["tableIndex"] - if table_index in existing_table_indices: - index = existing_table_indices[table_index] - result["table"][index]["bookmark"].append(bk_name) - else: - new_entry = {"tableIndex": table_index, "bookmark": [bk_name]} - result["table"].append(new_entry) - existing_table_indices[table_index] = ( - len(result["table"]) - 1 - ) # 更新索引记录 - else: - result["text"].append(bk_name) + # if bk_name in bookmark_in_table_position: + # table_index = bookmark_in_table_position[bk_name]["tableIndex"] + # if table_index in existing_table_indices: + # index = existing_table_indices[table_index] + # result["table"][index]["bookmark"].append(bk_name) + # else: + # new_entry = {"tableIndex": table_index, "bookmark": [bk_name]} + # result["table"].append(new_entry) + # existing_table_indices[table_index] = ( + # len(result["table"]) - 1 + # ) # 更新索引记录 + # else: + result["text"].append(bk_name) return result @@ -247,6 +247,13 @@ def InsertRow(location_bookmark_name, data, start_row_index=-1): raise RuntimeError(f"插入行时发生错误: {str(e)}") +def InsertRowWithJSONDefineCol(json_str): + """ + 插入行 + """ + + + def DebugCallInsertRow(): """ 调试调用