Address CSV export and field alignment review
This commit is contained in:
25
README.md
25
README.md
@@ -11,6 +11,7 @@
|
||||
- SQLite 使用纯 Go 驱动 `modernc.org/sqlite`,方便编译成单文件可执行程序。
|
||||
- 保底保存所有表格单元格到 `cells`。
|
||||
- 对常见报备表这种“标题行 + 表头行 + 数据行”的结构,自动生成 `fields`,便于按字段检索。
|
||||
- 内置导出 `fields` / `cells` CSV,不要求普通用户额外安装 `sqlite3`。
|
||||
|
||||
## 编译
|
||||
|
||||
@@ -32,12 +33,28 @@ go build -o bin/wordtable2sqlite .
|
||||
./bin/wordtable2sqlite -db data/report.sqlite *.docx
|
||||
```
|
||||
|
||||
导出字段化内容 CSV:
|
||||
|
||||
```bash
|
||||
./bin/wordtable2sqlite export-fields -db data/report.sqlite -out data/report-fields.csv
|
||||
```
|
||||
|
||||
导出原始单元格 CSV:
|
||||
|
||||
```bash
|
||||
./bin/wordtable2sqlite export-cells -db data/report.sqlite -out data/report-cells.csv
|
||||
```
|
||||
|
||||
参数:
|
||||
|
||||
- `-db`:输出 SQLite 文件路径,默认 `word_tables.sqlite`
|
||||
- `-reset`:导入前删除旧数据库
|
||||
- `-quiet`:不输出每个文件的摘要
|
||||
|
||||
## 适用范围
|
||||
|
||||
当前字段推断优先覆盖常见报备表:一行标题、一行表头、一行或多行数据。横向合并的表头会按逻辑列范围合并对应值。复杂多行表头、纵向合并、嵌套表格仍建议同时查看 `cells` 原始单元格结果。
|
||||
|
||||
## 数据表
|
||||
|
||||
- `documents`:每个导入的 Word 文件。
|
||||
@@ -58,3 +75,11 @@ SELECT table_index, row_index, cell_index, text
|
||||
FROM cells
|
||||
ORDER BY table_index, row_index, cell_index;
|
||||
```
|
||||
|
||||
## 验证
|
||||
|
||||
```bash
|
||||
go test ./...
|
||||
go vet ./...
|
||||
go build -o bin/wordtable2sqlite .
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user