diff --git a/internal/ingest/ingest.go b/internal/ingest/ingest.go index 168c7dc..fe2c2f8 100644 --- a/internal/ingest/ingest.go +++ b/internal/ingest/ingest.go @@ -361,6 +361,7 @@ func ParsersDescription() []core.ParserDesc { {ID: "builtin:pdf", Formats: []string{"pdf"}, Source: core.SourceBuiltin, Note: "文本层;扫描件为远期 MinerU 深度档"}, {ID: "builtin:xlsx", Formats: []string{"xlsx", "xlsm"}, Source: core.SourceBuiltin}, {ID: "builtin:pptx", Formats: []string{"pptx", "pptm", "ppsx"}, Source: core.SourceBuiltin}, + {ID: "builtin:legacy-office", Formats: []string{"doc", "xls", "ppt"}, Source: core.SourceBuiltin, Note: "不解析;提示转存现代格式后重传"}, {ID: "mineru", Formats: []string{"pdf", "png", "jpg"}, Source: core.SourcePlugin, Note: "远期可选:深度解析与交叉验证(默认不部署)"}, } } diff --git a/internal/ingest/ooxml_test.go b/internal/ingest/ooxml_test.go index a854eea..a252aa0 100644 --- a/internal/ingest/ooxml_test.go +++ b/internal/ingest/ooxml_test.go @@ -347,6 +347,7 @@ func TestParsersDescriptionMatchesDispatch(t *testing.T) { "docx": "builtin:docx", "pdf": "builtin:pdf", "xlsx": "builtin:xlsx", "xlsm": "builtin:xlsx", "pptx": "builtin:pptx", "pptm": "builtin:pptx", "ppsx": "builtin:pptx", + "doc": "builtin:legacy-office", "xls": "builtin:legacy-office", "ppt": "builtin:legacy-office", } for ext, wantID := range check { got, ok := byFormat[ext] @@ -360,3 +361,72 @@ func TestParsersDescriptionMatchesDispatch(t *testing.T) { } } } + +// TestParseXlsxWideColumnSkipsCellNotSheets:稀疏样式单元格落在远端列(XFD 区, +// 列序 ≥1024)只跳过该格并告警——不误报单元格上限、不丢弃后续工作表。 +func TestParseXlsxWideColumnSkipsCellNotSheets(t *testing.T) { + files := xlsxFixture() + // 第一表加一个列引用 XFD1(16384 列)的样式单元格;第二表(隐藏的"草稿")必须照常解析。 + files["xl/worksheets/sheet1.xml"] = strings.Replace(files["xl/worksheets/sheet1.xml"], + "\n\n边角样式\n= xlsxMaxCols { - truncated = true + // 稀疏样式单元格常落在远端列(XFD 区):跳过该格并告警, + // 不中断本表其余内容,也不阻断后续工作表。 + wide = true continue } cells[col] = xlsxCellText(c, shared, dateStyles, date1904) @@ -323,9 +333,9 @@ func xlsxSheetBlocks(data []byte, shared []string, dateStyles map[int]bool, date } } if len(rows) == 0 { - return nil, count, truncated + return nil, count, truncated, wide, "" } - return &core.DocBlock{Type: core.BlockTable, Rows: rows}, count, truncated + return &core.DocBlock{Type: core.BlockTable, Rows: rows}, count, truncated, wide, "" } // xlsxCellText 把单元格转成展示文本。