- 归档 OnlyOffice live bridge、Page AI、mindmap、design governance 与相关 bug 条目 - 补齐 MinerU OCR 后端 runtime 合同与 smoke/test 基线 - 收口 ChatOnly/Doubao、ObjectIdentity、Page Aggregate compat 与 runtime owner 文档口径 验证: - cargo test --manifest-path rust/Cargo.toml -p mnote-web local_ocr -- --test-threads=1 - cargo test --manifest-path rust/Cargo.toml -p mnote-web onlyoffice_bridge -- --test-threads=1 - git diff --check - git diff --cached --check - codegraph index . --force && codegraph status . - codegraph sync . && codegraph status .
3.8 KiB
3.8 KiB
MNote ONLYOFFICE live bridge
用于操作当前已经打开的 ONLYOFFICE 编辑器会话。
适用范围
- 仅针对当前浏览器里打开的 ONLYOFFICE 文档
- 支持 Word、Excel、PPT 的基础读写
- 不用于离线批量修改文件
可用工具
mnote.onlyoffice.session.currentmnote.onlyoffice.capabilitiesmnote.onlyoffice.selection.getmnote.onlyoffice.document.insert_textmnote.onlyoffice.document.replace_selectionmnote.onlyoffice.document.insert_htmlmnote.onlyoffice.document.exportmnote.onlyoffice.document.search_replacemnote.onlyoffice.document.insert_tablemnote.onlyoffice.document.get_commentsmnote.onlyoffice.document.add_commentmnote.onlyoffice.sheet.get_sheetsmnote.onlyoffice.sheet.add_sheetmnote.onlyoffice.sheet.rename_sheetmnote.onlyoffice.sheet.get_rangemnote.onlyoffice.sheet.get_range_valuesmnote.onlyoffice.sheet.get_valuesmnote.onlyoffice.sheet.set_valuemnote.onlyoffice.sheet.set_formulamnote.onlyoffice.sheet.batch_set_valuesmnote.onlyoffice.sheet.set_range_valuesmnote.onlyoffice.sheet.format_rangemnote.onlyoffice.sheet.set_dimensionsmnote.onlyoffice.sheet.sort_rangemnote.onlyoffice.sheet.add_chartmnote.onlyoffice.presentation.get_slidesmnote.onlyoffice.presentation.get_slide_textsmnote.onlyoffice.presentation.get_shapesmnote.onlyoffice.presentation.add_text_slidemnote.onlyoffice.presentation.replace_textmnote.onlyoffice.presentation.set_shape_textmnote.onlyoffice.presentation.delete_slidemnote.onlyoffice.presentation.add_tablemnote.onlyoffice.presentation.clear_slidemnote.onlyoffice.presentation.add_shape
使用原则
- 先调用
mnote.onlyoffice.session.current确认当前会话存在,并记录sessionId/documentId/assetId/fileType - 多个 ONLYOFFICE 标签页同时打开时,写操作必须显式传
onlyofficeSessionId - 写入前优先做最小范围修改,并先用
dryRun检查计划 - 读取大块表格时优先使用
sheet.get_values,写入多格时优先使用sheet.batch_set_values - 需要按用户可见坐标定位表格时优先使用 A1 地址工具:
sheet.get_range_values/sheet.set_range_values sheet.set_range_values只写入 A1 区域与二维values的交集,调用前应确认尺寸- 表格样式只做显式小范围:
sheet.format_range支持字体粗斜体、颜色、对齐和数字格式;sheet.set_dimensions支持零基行高/列宽 - Excel 排序使用
sheet.sort_range,先确认 A1 range,keyColumn是 range 内从 1 开始的列号;图表使用sheet.add_chart,默认柱状图 document.export仅支持markdown和html- Word 精确文本替换优先使用
document.search_replace - Word 插入结构化表格使用
document.insert_table;评论读取/添加使用document.get_comments/document.add_comment document.add_comment默认给当前选区加评论;没有可靠选区时显式传target: "document_start"- PPT 文本读取优先使用
presentation.get_slide_texts;presentation.replace_text只处理文本框纯文本,命中文本框会按纯文本段落重建 - PPT 精确改某个文本框时先调用
presentation.get_shapes获取shapeIndex/shapeId,再调用presentation.set_shape_text - 删除 PPT 幻灯片前必须先调用
presentation.get_slides或presentation.get_slide_texts确认slideIndex - PPT 插入结构化表格使用
presentation.add_table,默认居中插入;需要精确位置时传xMm/yMm/widthMm/heightMm - PPT 清空指定页对象使用
presentation.clear_slide,调用前必须确认目标slideIndex;添加基础图形使用presentation.add_shape - 需要大范围离线处理时,改用
officecli