From 62b0623c3476c971dc9bfa36cb0f3b3a4e0544a4 Mon Sep 17 00:00:00 2001
From: liding <756868258@qq.com>
Date: 星期一, 26 十月 2026 17:56:36 +0800
Subject: [PATCH] fix(report): 清除旧报告序号单元格中的默认下划线
---
src/utils/reportDocxLayout.js | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/src/utils/reportDocxLayout.js b/src/utils/reportDocxLayout.js
index ff2ae3f..8b081a6 100644
--- a/src/utils/reportDocxLayout.js
+++ b/src/utils/reportDocxLayout.js
@@ -164,6 +164,21 @@
return changed ? documentXml : null
}
+function clearDefaultSequenceUnderlines(xml) {
+ return xml.replace(resultTablePattern, table => {
+ if (!table.includes('搴忓彿') || !/(妫�娴嬬粨鏋渱妫�楠岀粨鏋�)/.test(table)) return table
+ return table.replace(tableRowPattern, row => row.replace(tableCellPattern, (cell, offset) => {
+ if (offset !== row.indexOf('<w:tc')) return cell
+ const text = [...cell.matchAll(/<w:t\b(?![^>]*\/>)[^>]*>([\s\S]*?)<\/w:t>/g)]
+ .map(match => match[1]).join('').trim()
+ if (!/^\d+$/.test(text)) return cell
+ // 鏃ф姤鍛婁腑鐨� <w:u w:color="auto"/> 榛樿浼氳瑙i噴鎴愬崟涓嬪垝绾裤��
+ // 鏄惧紡璁剧疆浜嗙被鍨嬬殑涓嬪垝绾夸繚鐣欙紝鍏佽鐢ㄦ埛鑷淇敼搴忓彿鏍煎紡銆�
+ return cell.replace(/<w:u\b[^>]*\/>/g, tag => /\bw:val=/.test(tag) ? tag : '')
+ }))
+ })
+}
+
export async function normalizeReportDocxForEditor(blob, reportCode) {
const zip = await JSZip.loadAsync(blob)
const documentPart = zip.file('word/document.xml')
@@ -173,6 +188,7 @@
const themeXml = themePart ? await themePart.async('string') : ''
const themeFonts = { major: chineseThemeFont(themeXml, 'major'), minor: chineseThemeFont(themeXml, 'minor') }
let normalizedXml = alignResultTable(documentXml) || documentXml
+ normalizedXml = clearDefaultSequenceUnderlines(normalizedXml)
normalizedXml = fitCoverCustomer(normalizedXml) || normalizedXml
normalizedXml = materializeChineseThemeFonts(normalizedXml, themeFonts) || normalizedXml
let changed = normalizedXml !== documentXml
--
Gitblit v1.9.3