Text Editing Operation Guidelines
Operating Principles
- Must be based on the selection — rewriting/polishing requires selected text
- Directly replace the selection — use
Selection.Text = "新文本" to replace
- Preserve formatting — when replacing text, try to preserve the original font, size, and color
Code template
var sel = Application.Selection;
var originalText = sel.Text;
if (!originalText || originalText.trim().length === 0) {
return "请先选中要修改的文本";
}
// 直接替换选区文本
sel.Text = "改写后的新文本";
return "已替换选区文本(原 " + originalText.length + " 字 → 新 " + sel.Text.length + " 字)";
Operation types and strategies
| Operation |
Strategy |
| Polish |
Preserve the original meaning, optimize wording and sentence structure |
| Rewrite |
Preserve the core semantics, completely change the expression |
| Expand |
Add details, examples, and transitional sentences on the basis of the original text |
| Condense |
Remove redundancy and distill the core information |
| Tone adjustment |
From colloquial→written/written→colloquial/neutral→formal/formal→casual |
Notes
- After rewriting, the information integrity of the original text must be preserved
- Do not change the paragraph structure of the original text (unless the user requests it)
- When rewriting long passages, process them in sections to avoid losing formatting information