From da14011e5f9c9e4888632bc3935bdae74f9b5301 Mon Sep 17 00:00:00 2001 From: zzs Date: Thu, 27 Mar 2025 15:48:21 +0800 Subject: [PATCH] wip: table error --- src/views/infra/bookmark/index.vue | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/views/infra/bookmark/index.vue b/src/views/infra/bookmark/index.vue index 40a3f3b..51bee34 100644 --- a/src/views/infra/bookmark/index.vue +++ b/src/views/infra/bookmark/index.vue @@ -591,12 +591,14 @@ function handleReplaceTextAndInsertTableRow(data: any) { const text = Payload.text const table = Payload.table const tableData: any[] = [] - for (const tab_obj of table) { - tableData.push({ - location_bookmark_name: tab_obj.bookmarkName, - start_row_index: tab_obj.startRowIndex, - data: tab_obj.data, - }) + if (table) { + for (const tab_obj of table) { + tableData.push({ + location_bookmark_name: tab_obj.bookmarkName, + start_row_index: tab_obj.startRowIndex, + data: tab_obj.data, + }) + } } sendMessageToWopiClient({ MessageId: 'CallPythonScript', @@ -620,12 +622,14 @@ function handleReplaceTextAndInsertTableRowWithContentControl(data: any) { const text = Payload.text const table = Payload.table const tableData: any[] = [] - for (const tab_obj of table) { - tableData.push({ - location_bookmark_name: tab_obj.bookmarkName, - start_row_index: tab_obj.startRowIndex, - data: tab_obj.data, - }) + if (table) { + for (const tab_obj of table) { + tableData.push({ + location_bookmark_name: tab_obj.bookmarkName, + start_row_index: tab_obj.startRowIndex, + data: tab_obj.data, + }) + } } sendMessageToWopiClient({ MessageId: 'CallPythonScript',