offline-office-editor

离线 Office 编辑器构建器:用于构建和维护单文件、完全离线的 Office 编辑器(Excel/Word/PowerPoint)的可复用模式,使用纯 JavaScript 且无需服务器。在 C:/office 项目中添加或修复功能时,或任何需要离线生成或编辑 .xlsx/.docx/.pptx 的任务中使用。特别关注条件格式、公式、批注、数据验证、图表、超链接、冻结窗格或行列结构,通过基于 SheetJS 手工编写的 OOXML 注入与读取后处理层实现,并由 jsdom 回归测试框架支持。

安装方式

先用 Prompt 核对来源与依赖。也可下载安装包。

用 AI 助手安装

复制提示词,让助手先核对固定版本和依赖。

查看 Prompt收起 Prompt
先检查当前 Agent 是否已安装 SkillPI Skill Finder。如果尚未安装,请按官方仓库的说明安装并启用:https://github.com/Findskills/skillpi。然后使用 Skill Finder 打开此 SkillPI 详情页并定位 "offline-office-editor":https://skillpi.com/zh/skills/deepskill-04556b36825c42ab21b04ccb50db9b119cc0dfcf8d45aa61d3386eca7e705255。安装前核对上游来源和版本:https://skillhub.cn/skills/user_538e39fa/offline-office-editor。来源不一致时停止并说明差异。核对通过后,用 Skill Finder 安装目标 Skill,并报告安装路径和来源版本。

来源与配置

skillhub.cn

配置方式待核实

请查看原始来源中的适用工具、依赖和权限要求。

安装实测待补充

离线 Office 编辑器构建器:用于构建和维护单文件、完全离线的 Office 编辑器(Excel/Word/PowerPoint)的可复用模式,使用纯 JavaScript 且无需服务器。在 C:/office 项目中添加或修复功能时,或任何需要离线生成或编辑 .xlsx/.docx/.pptx 的任务中使用。特别关注条件格式、公式、批注、数据验证、图表、超链接、冻结窗格或行列结构,通过基于 SheetJS 手工编写的 OOXML 注入与读取后处理层实现,并由 jsdom 回归测试框架支持。

0 下载

介绍来源: third_party · user_538e39fa · 1.0.0 参考来源

SkillPi 解读

能完成的任务
翻译待完成,请参阅来源文档。
适合谁
翻译待完成,请参阅来源文档。
输入和输出
来源文档未说明。
软件、账号及付费要求
来源文档未说明。
限制与区别
来源文档未说明。
实测状态
未测试

文件浏览

在原站浏览文件 ↗

原始 SKILL.md

打开原文 ↗
Frontmatter
name: offline-office-editor
description: "Reusable patterns for building and maintaining a single-file, fully offline Office editor (Excel/Word/PowerPoint) in plain JavaScript with no server. Use this skill when adding or fixing features in the C:/office project, or any task that needs to generate or edit .xlsx/.docx/.pptx files offline - especially conditional formatting, formulas, comments, data validation, charts, hyperlinks, freeze panes, or row/column structure - via a hand-rolled OOXML inject and read post-processing layer on top of SheetJS, backed by a jsdom regression-test harness."
agent_created: true

Offline Office Editor

Overview

The C:/office project is a single-page, zero-backend Office editor. Three editors (Excel grid, Word page, PPT stage) share one index.html + per-format engine (excel.js, word.js, ppt.js). A build step inlines every library and script into office-standalone.html (≈5.7 MB) so it runs by double-clicking — no server, no CDN, no network.

The hard part is not the UI; it is making Excel/Word/PPT files round-trip correctly. SheetJS (libs/xlsx.full.min.js) reads/writes the zip/XML but silently drops many features (conditional formatting, comments, data validation, charts, styles, freeze panes, hyperlinks). The project's solution is a OOXML post-processing layer: SheetJS produces a baseline file, then small injectXxx functions rewrite specific XML parts (worksheet, rels, [Content_Types].xml) to add what SheetJS missed; reverse readXxx functions parse those parts back on open. Regression is guaranteed by a jsdom harness that loads the real engine and asserts behavior.

When to use this skill

  • The user asks to add/fix any feature in the C:/office editors.
  • Any task to generate or edit .xlsx / .docx / .pptx offline, especially: conditional formatting (color scale, data bar, formula/cellIs rules), formula engine (absolute/cross-sheet refs, VLOOKUP/HLOOKUP/MATCH/INDEX/IFS), cell comments, data validation, charts, hyperlinks, freeze panes, row/column insert/delete, merged cells, custom styles.
  • When writing or debugging the jsdom regression tests for these features.

Core architecture (read this before editing)

Keep one mental model — it is the same for every feature:

  • Single source of truth = plain JS structures, NOT the OOXML. For Excel: data is a 2D array (ROWS × COLS); everything else is a parallel Map or array keyed by r + ',' + c (per-cell: styleMap, fmtMap, commentMap, borderMap, hyperlinks) or by a range/{r1,c1,r2,c2} (conditional formatting cfRules, data validation dvRules, merges). Word/PPT use analogous sheets[]/elements[] structures.
  • The editor renders from these structures (renderCell, renderAll). The file format is a serialization of them, never the source.
  • Two chain functions own the file boundary:
    • Save: buildAndSaveBuffer() → produces a Blob. Feature logic lives in injectXxx(zip, sheetsArr) helpers (see references/ooxml_paradigm.md).
    • Open: openWorkbook(buf) → reads via SheetJS for cell values, then calls readXxx(buf) helpers to recover dropped features into the JS structures.
  • Test/debug hooks: window.__excelDeep exposes internals (setCellValue, getCfRules, addCfRule, cfMatchCell, renderAll, saveToBuffer, openWorkbook, evaluate, …). The jsdom harness drives these to test real engine behavior without a browser.

Workflow: adding a new Excel feature

  1. Model it. Add the field to the per-cell Map or to cfRules/dvRules/ sheets[]. Decide the in-memory shape first (e.g. a CF rule is {r1,c1,r2,c2,type, ...}).
  2. Render it in renderCell/renderAll (and add CSS in styles.css). Text must always stay above overlay elements — give .cell-input position:relative; z-index:1 and overlays (cf-bar, markers) a lower z-index with pointer-events:none.
  3. Export it via an injectXxx function that rewrites the OOXML part, and wire it into buildAndSaveBuffer at the right CT_Worksheet child order.
  4. Import it via a readXxx function parsing the same part; wire into openWorkbook (wrap in try/catch — a missing part must not break open).
  5. Expose hooks on window.__excelDeep so the harness can set state and read state.
  6. Write a regression test _excel_<feature>_test.js (see references/regression_harness.md and scripts/regression_harness.js).
  7. Rebuild + smoke: node build-standalone.js, then run _standalone_smoke.js to confirm 0 load-time errors.

OOXML inject/read paradigm (the non-obvious core)

This is the most important reusable knowledge. Full code patterns, buffer-type rules, [Content_Types].xml override mechanics, rels wiring, and a worked conditional-formatting example live in references/ooxml_paradigm.md. Read it before writing any injectXxx/readXxx function. Key rules (do not skip):

  • Injectors take a JSZip instance and return an arraybuffer (NOT a Blob) so the next injector can JSZip.loadAsync it. Only the final buildAndSaveBuffer wraps the last buffer in new Blob([out]).
  • Always pair escapeXml with unescapeXml when round-tripping formulas or any text containing <, >, &, " (e.g. >A1>10< in a CF formula).
  • Keep the model type names distinct from the OOXML type names. Example: the in-memory CF rule uses type:'scale'|'bar'|'formula', while the OOXML <cfRule type="colorScale"|"dataBar"|"expression">. Map both directions; a mismatch silently drops the rule on save.
  • XLSX.write(..., {cellStyles:true}) then JSZip.loadAsync the array result.

jsdom regression harness

Every feature ships with a test that loads the real engine in jsdom and asserts behavior (including full save→reopen round-trips). The template, the exact NODE_PATH, the jsdom ^24 pin, and the two classic harness bugs (un-awaited async in setTimeout; || -1 turning a legitimate 0 into -1) are detailed in references/regression_harness.md and the ready-to-copy scripts/regression_harness.js.

Resources

  • references/ooxml_paradigm.md — save/read chain, buffer types, Content_Types overrides, rels, worked conditional-formatting + comments examples.
  • references/regression_harness.md — jsdom harness template, env setup, gotchas.
  • scripts/regression_harness.js — copy-paste harness skeleton for a new test.

当前收录版本

1.0.0

核对来源版本 ↗

安全与评测信息

质量评测

满分100 · 来自 SkillPi LAB 实验室的评测报告。

场景价值85/100

亮点

  • 提供完整的离线 Office 编辑器开发模式,涵盖 Excel/Word/PPT 的 OOXML 后处理与 SheetJS 增强
  • 面向 C:/office 项目维护等明确技术场景,具有高度专业性和实用价值
触发精准90/100

亮点

  • 触发词完整覆盖 .xlsx/.docx/.pptx 文件格式及 conditional formatting、formulas、comments 等具体功能点
  • 使用场景描述清晰,边界明确,便于精准触发
结构规范95/100

待提升项

  • description 重复 原报告严重程度:轻微

    顶层 frontmatter 和 skill_body 内部均包含完整 description,存在冗余

    改进建议:建议仅在顶层 frontmatter 保留 description,skill_body 内可简化为引用或省略

亮点

  • 文档结构清晰,包含 Overview、Core architecture、Workflow、OOXML paradigm 等完整章节
  • 步骤划分明确,有端到端示例指引,frontmatter 完整
执行可靠90/100

亮点

  • 工具来源明确(SheetJS、jsdom),参数规则详细(buffer 类型、XML 转义、模型与 OOXML 类型映射)
  • 覆盖主要异常处理(try/catch 包裹 readXxx),并提供 jsdom 回归测试保障
证据可验 (前四项均值)90/100

取前四项原始分值的算术平均,四舍五入取整。可通过收录报告核对各项评分与说明,运行记录需单独查证。

正文静态检测

100 / 100 · skillpi-20261123-no-r3-v1

正文未命中当前规则。

分数仅反映正文中的规则命中,供使用前参考。附件与运行行为不在此评分范围内。

权限与使用前检查

根据当前主文档自动整理,命中内容可能是示例或防护说明;不是实际权限声明,也未覆盖附件、外部依赖或运行行为。

未从主文档识别到上述常见操作,不能据此判断无需权限或没有风险。

本站展示提示不会授予权限。涉及文件改动、密钥、外部发送或费用时,仍由你使用的工具按需确认。

安全评级与访问范围

safe · 静态证据核验,不代表运行安全保证。

来源文档未说明。

使用前请由宿主核对并授权实际文件读写、外部服务和联网目的地;本站的核验不会授予任何运行权限。