From 6a4cd00d51e52ce44fe0ec151260c4624d8a419b Mon Sep 17 00:00:00 2001 From: chrocy Date: Fri, 3 Apr 2026 20:24:59 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix(export):=20=E8=A1=A5=E5=85=A8=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E5=BC=B9=E7=AA=97=E4=B8=AD=E7=BC=BA=E5=A4=B1=E7=9A=84?= =?UTF-8?q?=20Excel=20=E5=AE=8C=E6=95=B4=E5=88=97=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E5=BC=80=E5=85=B3=20(fix=20#529)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/ExportPage.tsx | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/pages/ExportPage.tsx b/src/pages/ExportPage.tsx index ae5f9e7..14926f5 100644 --- a/src/pages/ExportPage.tsx +++ b/src/pages/ExportPage.tsx @@ -8128,6 +8128,28 @@ function ExportPage() { )} + {options.format === 'excel' && ( +
+
+
+

导出完整列

+
+ 开启后将在 Excel 表格中单独拆分出「发送者昵称」、「微信ID」、「备注」和「群昵称」列。关闭则只保留紧凑的「发送者身份」。 +
+
+ +
+
+ )} +

时间范围

From f9313392f1ca555fad87322ab20793106731983e Mon Sep 17 00:00:00 2001 From: chrocy Date: Tue, 7 Apr 2026 16:44:59 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=20Excel=20?= =?UTF-8?q?=E5=AF=BC=E5=87=BA=E8=AE=BE=E7=BD=AE=EF=BC=8C=E8=A7=A3=E5=86=B3?= =?UTF-8?q?=20#529=EF=BC=8C=E5=B0=86=E3=80=8C=E5=AF=BC=E5=87=BA=E5=AE=8C?= =?UTF-8?q?=E6=95=B4=E5=88=97=E3=80=8D=E9=80=89=E9=A1=B9=E5=90=88=E5=B9=B6?= =?UTF-8?q?=E5=88=B0=E3=80=8C=E5=8F=91=E9=80=81=E8=80=85=E5=90=8D=E7=A7=B0?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E3=80=8D=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/pages/ExportPage.tsx | 86 +++++++++++++++++++++------------------- 1 file changed, 45 insertions(+), 41 deletions(-) diff --git a/src/pages/ExportPage.tsx b/src/pages/ExportPage.tsx index 14926f5..133f496 100644 --- a/src/pages/ExportPage.tsx +++ b/src/pages/ExportPage.tsx @@ -8128,27 +8128,7 @@ function ExportPage() {
)} - {options.format === 'excel' && ( -
-
-
-

导出完整列

-
- 开启后将在 Excel 表格中单独拆分出「发送者昵称」、「微信ID」、「备注」和「群昵称」列。关闭则只保留紧凑的「发送者身份」。 -
-
- -
-
- )} +
@@ -8230,27 +8210,51 @@ function ExportPage() {
)} - {shouldShowDisplayNameSection && ( + {(shouldShowDisplayNameSection || options.format === 'excel') && (
-

发送者名称显示

-
- {displayNameOptions.map(option => { - const isActive = options.displayNamePreference === option.value - return ( - - ) - })} -
+ {shouldShowDisplayNameSection && ( + <> +

发送者名称显示

+
+ {displayNameOptions.map(option => { + const isActive = options.displayNamePreference === option.value + return ( + + ) + })} +
+ + )} + + {options.format === 'excel' && ( +
+
+

导出完整列

+
+ 开启后将在 Excel 表格中单独拆分出「发送者昵称」、「微信ID」、「备注」和「群昵称」列。关闭则只保留紧凑的「发送者身份」。 +
+
+ +
+ )}
)}
From 01fc5cd1a0737fec3f20fc59bad364be0c3aa07d Mon Sep 17 00:00:00 2001 From: xuncha <1658671838@qq.com> Date: Tue, 7 Apr 2026 19:25:57 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=9C=A8=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E5=AE=8C=E6=95=B4=E5=88=97=E7=9A=84=E6=97=B6=E5=80=99?= =?UTF-8?q?=E7=A7=81=E8=81=8A=E4=B8=8D=E4=BC=9A=E6=9C=89=E7=BE=A4=E6=98=B5?= =?UTF-8?q?=E7=A7=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/services/exportService.ts | 106 ++++++++++++++++++++--------- src/pages/ExportPage.tsx | 2 +- 2 files changed, 76 insertions(+), 32 deletions(-) diff --git a/electron/services/exportService.ts b/electron/services/exportService.ts index 6363e98..2512f72 100644 --- a/electron/services/exportService.ts +++ b/electron/services/exportService.ts @@ -6491,9 +6491,12 @@ class ExportService { currentRow++ // 表头行 + const includeGroupNicknameColumn = !useCompactColumns && isGroup const headers = useCompactColumns ? ['序号', '时间', '发送者身份', '消息类型', '内容'] - : ['序号', '时间', '发送者昵称', '发送者微信ID', '发送者备注', '群昵称', '发送者身份', '消息类型', '内容'] + : includeGroupNicknameColumn + ? ['序号', '时间', '发送者昵称', '发送者微信ID', '发送者备注', '群昵称', '发送者身份', '消息类型', '内容'] + : ['序号', '时间', '发送者昵称', '发送者微信ID', '发送者备注', '发送者身份', '消息类型', '内容'] const headerRow = worksheet.getRow(currentRow) headerRow.height = 22 @@ -6521,10 +6524,16 @@ class ExportService { worksheet.getColumn(3).width = 18 // 发送者昵称 worksheet.getColumn(4).width = 25 // 发送者微信ID worksheet.getColumn(5).width = 18 // 发送者备注 - worksheet.getColumn(6).width = 18 // 群昵称 - worksheet.getColumn(7).width = 15 // 发送者身份 - worksheet.getColumn(8).width = 12 // 消息类型 - worksheet.getColumn(9).width = 50 // 内容 + if (includeGroupNicknameColumn) { + worksheet.getColumn(6).width = 18 // 群昵称 + worksheet.getColumn(7).width = 15 // 发送者身份 + worksheet.getColumn(8).width = 12 // 消息类型 + worksheet.getColumn(9).width = 50 // 内容 + } else { + worksheet.getColumn(6).width = 15 // 发送者身份 + worksheet.getColumn(7).width = 12 // 消息类型 + worksheet.getColumn(8).width = 50 // 内容 + } } // 预加载群昵称 (仅群聊且完整列模式) @@ -6805,7 +6814,7 @@ class ExportService { enrichedContentValue = this.buildQuotedReplyText(quotedReplyDisplay) } - const contentCellIndex = useCompactColumns ? 5 : 9 + const contentCellIndex = useCompactColumns ? 5 : (includeGroupNicknameColumn ? 9 : 8) const contentCell = worksheet.getCell(currentRow, contentCellIndex) worksheet.getCell(currentRow, 1).value = i + 1 @@ -6813,13 +6822,19 @@ class ExportService { if (useCompactColumns) { worksheet.getCell(currentRow, 3).value = senderRole worksheet.getCell(currentRow, 4).value = this.getMessageTypeName(msg.localType) - } else { + } else if (includeGroupNicknameColumn) { worksheet.getCell(currentRow, 3).value = senderNickname worksheet.getCell(currentRow, 4).value = senderWxid worksheet.getCell(currentRow, 5).value = senderRemark worksheet.getCell(currentRow, 6).value = senderGroupNickname worksheet.getCell(currentRow, 7).value = senderRole worksheet.getCell(currentRow, 8).value = this.getMessageTypeName(msg.localType) + } else { + worksheet.getCell(currentRow, 3).value = senderNickname + worksheet.getCell(currentRow, 4).value = senderWxid + worksheet.getCell(currentRow, 5).value = senderRemark + worksheet.getCell(currentRow, 6).value = senderRole + worksheet.getCell(currentRow, 7).value = this.getMessageTypeName(msg.localType) } contentCell.value = enrichedContentValue if (!quotedReplyDisplay) { @@ -6929,6 +6944,7 @@ class ExportService { }) const worksheet = workbook.addWorksheet('聊天记录') const useCompactColumns = options.excelCompactColumns === true + const includeGroupNicknameColumn = !useCompactColumns && isGroup const senderProfileCache = new Map() worksheet.columns = useCompactColumns @@ -6939,17 +6955,28 @@ class ExportService { { width: 12 }, { width: 50 } ] - : [ - { width: 8 }, - { width: 20 }, - { width: 18 }, - { width: 25 }, - { width: 18 }, - { width: 18 }, - { width: 15 }, - { width: 12 }, - { width: 50 } - ] + : includeGroupNicknameColumn + ? [ + { width: 8 }, + { width: 20 }, + { width: 18 }, + { width: 25 }, + { width: 18 }, + { width: 18 }, + { width: 15 }, + { width: 12 }, + { width: 50 } + ] + : [ + { width: 8 }, + { width: 20 }, + { width: 18 }, + { width: 25 }, + { width: 18 }, + { width: 15 }, + { width: 12 }, + { width: 50 } + ] const appendRow = (values: any[]) => { const row = worksheet.addRow(values) @@ -6962,7 +6989,9 @@ class ExportService { appendRow([]) appendRow(useCompactColumns ? ['序号', '时间', '发送者身份', '消息类型', '内容'] - : ['序号', '时间', '发送者昵称', '发送者微信ID', '发送者备注', '群昵称', '发送者身份', '消息类型', '内容']) + : includeGroupNicknameColumn + ? ['序号', '时间', '发送者昵称', '发送者微信ID', '发送者备注', '群昵称', '发送者身份', '消息类型', '内容'] + : ['序号', '时间', '发送者昵称', '发送者微信ID', '发送者备注', '发送者身份', '消息类型', '内容']) for (let i = 0; i < totalMessages; i++) { if ((i & 0x7f) === 0) this.throwIfStopRequested(control) @@ -7077,19 +7106,34 @@ class ExportService { this.getMessageTypeName(msg.localType), enrichedContentValue ] - : [ - i + 1, - this.formatTimestamp(msg.createTime), - senderNickname, - senderWxid, - senderRemark, - senderGroupNickname, - senderRole, - this.getMessageTypeName(msg.localType), - enrichedContentValue - ]) + : includeGroupNicknameColumn + ? [ + i + 1, + this.formatTimestamp(msg.createTime), + senderNickname, + senderWxid, + senderRemark, + senderGroupNickname, + senderRole, + this.getMessageTypeName(msg.localType), + enrichedContentValue + ] + : [ + i + 1, + this.formatTimestamp(msg.createTime), + senderNickname, + senderWxid, + senderRemark, + senderRole, + this.getMessageTypeName(msg.localType), + enrichedContentValue + ]) if (!quotedReplyDisplay) { - this.applyExcelLinkCardCell(row.getCell(useCompactColumns ? 5 : 9), msg.content, msg.localType) + this.applyExcelLinkCardCell( + row.getCell(useCompactColumns ? 5 : (includeGroupNicknameColumn ? 9 : 8)), + msg.content, + msg.localType + ) } row.commit() diff --git a/src/pages/ExportPage.tsx b/src/pages/ExportPage.tsx index f513db0..750d496 100644 --- a/src/pages/ExportPage.tsx +++ b/src/pages/ExportPage.tsx @@ -8440,7 +8440,7 @@ function ExportPage() {

导出完整列

- 开启后将在 Excel 表格中单独拆分出「发送者昵称」、「微信ID」、「备注」和「群昵称」列。关闭则只保留紧凑的「发送者身份」。 + 开启后会在 Excel 表格中拆分出「发送者昵称」、「微信ID」、「备注」等列;群聊会额外包含「群昵称」列,私聊不会显示这一列。关闭则只保留紧凑的「发送者身份」。