Commit graph

9 commits

Author SHA1 Message Date
zmworm
b18e52687a refactor: fold 'check' command into 'view <file> issues'
Text-overflow scanning now emits as DocumentIssue (Format+Warning, Id
prefix 'O') from ExcelHandler/PowerPointHandler ViewAsIssues, reusing
the existing CheckAllCellOverflow and CheckTextOverflow logic. The
standalone 'officecli check' command is removed — users migrate to
'officecli view <file> issues' (optionally '--type format').

Underlying CheckShapeTextOverflow/CheckCellOverflow/CheckAllCellOverflow
handler APIs are retained; they still back the inline overflow warning
emitted on add/set through the resident server.
2026-04-19 14:44:02 +08:00
zmworm
e0690730be feat(ole): comprehensive OLE (Object Linking and Embedding) support across docx/xlsx/pptx
Implement full OLE lifecycle (Add/Query/Get/Set/Remove) with cross-format
consistency. Shared OleHelper provides ProgID detection, part cleanup on
failure, self-embed handling, and input validation.

Highlights:
- Word: VML shape + o:OLEObject with deduped shapetype, header/footer OLE,
  v:shape@alt for name, body scoped query with attr filter, SDT support
- Excel: modern oleObject + objectPr/ObjectAnchor with sub-cell EMU precision
  for unit-qualified width/height round-trip, VML placeholder shape
- PowerPoint: GraphicFrame with p:oleObj, slide-scoped query (both CSS and
  path styles), full set vocabulary incl. name/display/width/height
- Canonical Format schema: progId, contentType, fileSize, width, height,
  display, name, relId (cross-format consistent)
- get --save <path> extracts embedded binary payload with savedTo/savedBytes
- raw <sheet>/<relId> fallback for inspecting OLE embedded parts
- view outline/stats/text report OLE counts and placeholders uniformly
- Query attribute filter supports [progId=], [fileSize>], [progId~=], etc.
- Resident mode: supports add/set/remove/swap/get --save for OLE
- Help: docx/xlsx/pptx add help documents OLE type + properties
- Aliases: ole, oleobject, object, embed (add + query, case-insensitive)

Error handling:
- ProgID validation (≤39 chars, no leading digit, valid COM chars)
- Empty source file emits stderr warning
- Locked source file surfaces friendly "close resident first" hint
- Negative width/height rejected on set
- Excel display/name explicitly rejected (schema unsupported)
- Invalid display value rejected with clear error
2026-04-11 18:51:21 +08:00
zmworm
11499f6b23 fix(xlsx/view): show pivot table count in outline for pivot-only sheets
A worksheet whose only content is a pivot table has empty <sheetData> —
Excel/Calc render the cells from pivotCacheRecords at display time, but
DOM-only libraries (POI, Open XML SDK, officecli) never materialize them.
Outline previously showed such sheets as '0 rows × 0 cols', misleading
users into thinking the sheet was empty.

Match POI's strategy (XSSFSheet.getPivotTables) by surfacing the pivot
count directly in the outline line:

  ├── "透视表" (0 rows × 0 cols, 1 pivot table(s))

Pivot details remain queryable via 'query pivottable'.
2026-04-08 19:03:30 +08:00
zmworm
f7441946e8 feat: add find+format, find+replace, and text-anchored insert for Word and PowerPoint
- Add `set find=` to format or replace matched text with auto run splitting
- Support regex via r"..." prefix (e.g. find=r"\d+%")
- Unify find+replace (replaces old scope-based FindAndReplace)
- Add `--after find:X` / `--before find:X` for positional element insertion
- Word: inline (run) and block (table/paragraph) insertion with auto paragraph splitting
- PowerPoint: inline run insertion at text positions
- Support all run-level format properties through find pathway
- Update SKILL.md, wiki, and skill docs with new syntax
2026-04-04 21:19:02 +08:00
zmworm
807846448e fix(excel): correct column count in view outline for sparse sheets
Column count was calculated from the first row's cell count only,
underreporting for sheets where later rows have more columns. Now
uses SheetDimension element when available, falls back to scanning
all rows for the maximum cell count.
2026-03-29 15:27:06 +08:00
zmworm
8f93c26d24 feat: return structured JSON for view stats/outline/text --json
Instead of wrapping human-readable strings in a Content field,
stats/outline/text modes now return properly structured JSON with
typed fields (arrays, objects, numbers) when --json is used.
This eliminates the need for models to parse tree symbols and
newline-delimited text.
2026-03-23 03:47:38 +08:00
zmworm
691e834874 fix: use InnerText/IEnumValue for OpenXML enum serialization instead of ToString 2026-03-19 19:36:08 +08:00
zmworm
bd0bdf5714 feat: use element paths in view output, add table query/formula set, and page size in doc properties 2026-03-19 00:02:24 +08:00
zmworm
d33421c671 Refactor handlers into partial classes using subdirectory split
Split WordHandler.cs (2878→114 lines), ExcelHandler.cs (1452→218 lines),
and PowerPointHandler.cs into focused partial class files under
Handlers/Word/, Handlers/Excel/, and Handlers/Pptx/ respectively.
Also fix duplicated content in build.sh.
2026-03-16 15:26:18 +08:00