处理表格
This commit is contained in:
@@ -231,14 +231,6 @@ export default {
|
||||
|
||||
var colspan = gridSpan ? parseInt(gridSpan.getAttribute("w:val"), 10) : 1;
|
||||
var rowspan = 1;
|
||||
|
||||
// if (vMerge) {
|
||||
// if (vMerge.getAttribute("w:val") === "restart") {
|
||||
// rowspan = 4;
|
||||
// } else {
|
||||
// continue;
|
||||
// }
|
||||
// }
|
||||
if (vMerge) {
|
||||
if (vMerge.getAttribute("w:val") === "restart") {
|
||||
rowspan = 1; // 初始化 rowspan
|
||||
@@ -247,22 +239,22 @@ export default {
|
||||
|
||||
while (nextRowIdx < rows.length) {
|
||||
const nextRowCells = rows[nextRowIdx].getElementsByTagNameNS(namespace, "tc");
|
||||
console.log(`🔍 检查下一行单元格 at row ${nextRowIdx}, col ${cellIndex}:`, nextRowCells);
|
||||
// console.log(`🔍 检查下一行单元格 at row ${nextRowIdx}, col ${cellIndex}:`, nextRowCells);
|
||||
|
||||
if (nextRowCells.length > cellIndex) {
|
||||
const nextCell = nextRowCells[cellIndex];
|
||||
|
||||
if (!nextCell) {
|
||||
console.warn(`⚠️ nextCell 未定义 at row ${nextRowIdx}, col ${cellIndex}`);
|
||||
// console.warn(`⚠️ nextCell 未定义 at row ${nextRowIdx}, col ${cellIndex}`);
|
||||
break;
|
||||
}
|
||||
|
||||
const nextVMerge = nextCell.getElementsByTagNameNS(namespace, "vMerge")[0];
|
||||
console.log(`🔍 检查 nextVMerge at row ${nextRowIdx}, col ${cellIndex}:`, nextVMerge);
|
||||
// console.log(`🔍 检查 nextVMerge at row ${nextRowIdx}, col ${cellIndex}:`, nextVMerge);
|
||||
|
||||
// **如果 nextVMerge 为空,则不应继续增长 rowspan**
|
||||
if (!nextVMerge) {
|
||||
console.log(`⚠️ nextVMerge 为空 at row ${nextRowIdx}, col ${cellIndex} - 停止扩展`);
|
||||
// console.log(`⚠️ nextVMerge 为空 at row ${nextRowIdx}, col ${cellIndex} - 停止扩展`);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -272,21 +264,21 @@ export default {
|
||||
if (!vMergeVal || vMergeVal === "continue") {
|
||||
if (rowspan < maxRowspan) { // 限制 rowspan 最大值
|
||||
rowspan++;
|
||||
console.log(`✅ rowspan 扩展到: ${rowspan} (row: ${nextRowIdx}, col: ${cellIndex})`);
|
||||
// console.log(`✅ rowspan 扩展到: ${rowspan} (row: ${nextRowIdx}, col: ${cellIndex})`);
|
||||
nextRowIdx++;
|
||||
} else {
|
||||
console.log(`⛔ 最大 rowspan 限制 ${rowspan},在 row ${nextRowIdx} 停止`);
|
||||
// console.log(`⛔ 最大 rowspan 限制 ${rowspan},在 row ${nextRowIdx} 停止`);
|
||||
break;
|
||||
}
|
||||
} else if (vMergeVal === "restart") {
|
||||
console.log(`⛔ 停止 rowspan 扩展 at row ${nextRowIdx}, 因为 w:val="restart"`);
|
||||
// console.log(`⛔ 停止 rowspan 扩展 at row ${nextRowIdx}, 因为 w:val="restart"`);
|
||||
break;
|
||||
} else {
|
||||
console.log(`⚠️ 未知 w:val="${vMergeVal}" at row ${nextRowIdx},停止合并`);
|
||||
// console.log(`⚠️ 未知 w:val="${vMergeVal}" at row ${nextRowIdx},停止合并`);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
console.warn(`⚠️ Row ${nextRowIdx} 没有足够的列 cellIndex ${cellIndex}`);
|
||||
// console.warn(`⚠️ Row ${nextRowIdx} 没有足够的列 cellIndex ${cellIndex}`);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -295,10 +287,6 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
console.log('rowspan at line 265:', rowspan)
|
||||
const currentLevelNumbers = {};
|
||||
for (const paragraph of paragraphs) {
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
//记得切换
|
||||
|
||||
//正式
|
||||
// const mediaUrl = '/public/';
|
||||
// const baseUrl = '/';
|
||||
const mediaUrl = '/public/';
|
||||
const baseUrl = '/';
|
||||
|
||||
|
||||
const mediaUrl = 'https://submission.tmrjournals.com/public/';
|
||||
const baseUrl = '/api';
|
||||
// const mediaUrl = 'https://submission.tmrjournals.com/public/';
|
||||
// const baseUrl = '/api';
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user