← 返回 Skills 市场
a-lhliang

国央企word文档

作者 刘洪亮Leo · GitHub ↗ · v1.6.0 · MIT-0
cross-platform ✓ 安全检测通过
62
总下载
1
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install gov-doc-writing
功能描述
此技能用于创建符合中国政府及央企规范的Word文档(.docx)。当用户要求创建公文、国央企文档、规范文书、正式报告等需要特定中国公文格式的文档时使用此技能。
使用说明 (SKILL.md)

国央企Work文档创建技能

本技能用于创建符合中国政府及央企规范的Word文档(.docx),使用Microsoft Word最新格式。

文档格式规范

页面设置

属性
纸张 A4
上边距 3.7厘米
下边距 3.5厘米
左边距 2.8厘米
右边距 2.6厘米
页码 居中显示,宋体四号

字体规范

样式 中文字体 西文字体 字号
首页大标题 方正小标宋简体 (FZXiaoBiaoSong-B05S) Times New Roman 小二号 (18pt)
正文 方正仿宋简体 (FZFangSong-Z02S) Times New Roman 小三号 (15pt)
一级标题 黑体 Times New Roman 小三号 (15pt)
二级标题 楷体 Times New Roman 小三号 (15pt)
三级标题 方正仿宋简体 (FZFangSong-Z02S) Times New Roman 小三号 (15pt) 加粗
页码 宋体 - 四号 (14pt)
表格 方正仿宋简体 (FZFangSong-Z02S) Times New Roman 小五号 (9pt)

行间距

样式 行间距
首页大标题 固定28磅
正文 固定28磅
一级标题 固定28磅
二级标题 固定28磅
三级标题 固定28磅
图片 单倍行距
表格 单倍行距

段落格式

样式 序号格式 首行缩进 大纲级别
正文有缩进 2字符 -
一级的标题 一、二、三、 2字符 1级
二级的标题 (一)(二)(三) 2字符 2级
三级的标题 1.2.3. 2字符 3级

样式名称

创建文档时,必须使用以下样式名称:

  • 首页大标题 - 首页大标题
  • 正文有缩进 - 正文段落
  • 一级的标题 - 一级标题
  • 二级的标题 - 二级标题
  • 三级的标题 - 三级标题
  • 图片样式 - 图片
  • 表格样式 - 表格
  • 页码样式 - 页脚页码

使用方法

方式一:使用JavaScript脚本创建文档

const {
  createDocument,
  createTitleParagraph,
  createBodyParagraph,
  createLevel1Heading,
  createLevel2Heading,
  createLevel3Heading,
  createTable,
  createImageParagraph,
  CHINESE_FONTS,
  FONT_SIZES,
  CONTENT_WIDTH,
  Packer,
  BorderStyle,
  WidthType,
  ShadingType,
  VerticalAlign,
  Paragraph,
  TextRun,
  Table,
  TableRow,
  TableCell,
  Footer,
  ImageRun,
} = require('~/.workbuddy/skills/gov-doc-writing/scripts/create_gov_doc.js');

// 创建文档
const doc = createDocument({
  title: '文档标题',
  sections: [
    // 首页大标题
    createTitleParagraph('这是文档标题'),

    // 一级标题
    createLevel1Heading('第一章', 0),  // 输出: 一、第一章
    createLevel1Heading('第二章', 1),  // 输出: 二、第二章

    // 二级标题
    createLevel2Heading('第一节', 0),  // 输出: (一)第一节
    createLevel2Heading('第二节', 1),  // 输出: (二)第二节

    // 三级标题
    createLevel3Heading('第一点', 0),  // 输出: 1.第一点
    createLevel3Heading('第二点', 1),  // 输出: 2.第二点

    // 正文
    createBodyParagraph('这是正文内容,首行自动缩进2字符。'),

    // 表格
    createTable(
      [
        { children: ['表头1', '表头2', '表头3'] },
        { children: ['内容1', '内容2', '内容3'] },
      ],
      { columnWidths: [2000, 2000, 2000] }
    ),
  ]
});

// 生成文件
Packer.toBuffer(doc).then(buffer => {
  fs.writeFileSync('output.docx', buffer);
});

方式二:使用CLI命令

node scripts/create_gov_doc.js output.docx '{
  "title": "文档标题",
  "body": [
    {"type": "heading1", "text": "第一章", "number": 0},
    {"type": "paragraph", "text": "正文内容"},
    {"type": "table", "rows": [...], "columnWidths": [2000, 2000, 2000]}
  ]
}'

表格规范

  • 表格宽度自动适应窗口(百分比100%),无需手动计算列宽
  • 列宽比例通过 columnWidths 参数控制(DXA 相对值,实际宽度自动缩放)
  • 表头:灰色底 (#D9D9D9)、加粗、居中
  • 内容:白色底、居中、小五号 (9pt) 字体
  • 边框:单线黑色
// 表格示例
const border = { style: BorderStyle.SINGLE, size: 1, color: "000000" };
const borders = { top: border, bottom: border, left: border, right: border };

// 表头行
new TableRow({
  tableHeader: true,
  children: [
    new TableCell({
      borders,
      shading: { fill: "D9D9D9", type: ShadingType.CLEAR },
      children: [new Paragraph({ children: [new TextRun({ text: "表头", bold: true })] })]
    })
  ]
});

图片规范

  • 行间距:单倍行距
  • 对齐:居中
  • 样式名称:图片样式

文档属性

  • 删除文档作者(dc:creatorlastModifiedBy 留空或不写入)
  • 在创建文档时不要设置 creator 属性,或设置为空字符串

完整示例

const fs = require('fs');
const {
  Document, Packer, Paragraph, TextRun, Table, TableRow, TableCell,
  Footer, BorderStyle, WidthType, ShadingType, VerticalAlign,
  PageNumber, ImageRun, AlignmentType, HeadingLevel, LevelFormat,
  createTitleParagraph, createBodyParagraph, createLevel1Heading,
  createLevel2Heading, createLevel3Heading, createTable,
  createImageParagraph, createDocument, CHINESE_FONTS, FONT_SIZES,
  CONTENT_WIDTH, PAGE_MARGINS, LINE_SPACING_EXACT_28
} = require('~/.workbuddy/skills/gov-doc-writing/scripts/create_gov_doc.js');

// 内容构建
const sections = [
  createTitleParagraph('关于XXX工作的报告'),

  createLevel1Heading('一、基本情况', 0),
  createBodyParagraph('这里是正文内容,详细描述基本情况。'),
  createBodyParagraph('继续描述相关内容和细节。'),

  createLevel1Heading('二、主要做法', 1),
  createLevel2Heading('(一)加强组织领导', 0),
  createBodyParagraph('具体做法描述...'),
  createLevel2Heading('(二)完善制度建设', 1),
  createBodyParagraph('制度建设内容...'),

  createLevel1Heading('三、存在问题', 2),
  createBodyParagraph('当前存在以下问题:'),
  createLevel3Heading('问题一', 0),
  createBodyParagraph('问题一的具体描述。'),
  createLevel3Heading('问题二', 1),
  createBodyParagraph('问题二的具体描述。'),

  createLevel1Heading('四、下一步计划', 3),
  createBodyParagraph('针对以上问题,计划采取以下措施...'),
];

// 创建文档(不设置作者)
const doc = createDocument({
  title: '关于XXX工作的报告',
  sections
});

// 生成并保存
Packer.toBuffer(doc).then(buffer => {
  fs.writeFileSync('report.docx', buffer);
  console.log('文档已生成: report.docx');
});

注意事项

  1. 字号转换:Word中的"号"转换为半磅值(如小三号=30,小二号=36,四号=28,小五号=18)
  2. 行间距固定28磅:line值设置为560(28 × 20),lineRule设置为"exact"
  3. 首行缩进:使用 indent: { firstLine: charWidth * 2 },字符宽度约等于字号的一半
  4. 页码:仅在页脚居中显示,使用宋体四号
  5. 不要封面:文档从首页大标题开始,不创建封面页
  6. 文档作者:不设置或留空
  7. 双引号自动规范化:所有文本内容中的 ASCII 双引号 " 会自动替换为配对的中文双引号 ""\u201c/\u201d),无需手动转换

相关文件

  • scripts/create_gov_doc.js - 核心创建函数库
安全使用建议
This skill appears coherent for generating Chinese government-style .docx documents: it uses the 'docx' library and local file writes only, and it does not ask for credentials or network access. Before running: (1) inspect the full scripts/create_gov_doc.js file yourself (the prompt view was truncated) to confirm there are no hidden network calls or exec/eval usage; (2) run it in a sandbox or isolated environment the first time; (3) ensure Node and the 'docx' dependency are installed (npm install) before executing; (4) be aware the script assumes certain Chinese fonts (e.g., 方正仿宋) which may not be present on your system — missing fonts affect appearance but not security; (5) the examples show a tilde-based require path (~/...) that may not expand in Node require calls — adjust the require path to the actual script location when using the code.
功能分析
Type: OpenClaw Skill Name: gov-doc-writing Version: 1.6.0 The skill bundle is a legitimate utility designed to generate Word documents (.docx) following specific Chinese government and state-owned enterprise formatting standards. The core logic in `scripts/create_gov_doc.js` utilizes the reputable 'docx' library to handle document structure, typography, and layout. There is no evidence of data exfiltration, malicious code execution, or harmful prompt injection; the instructions in `SKILL.md` are strictly focused on guiding the AI agent to apply correct styles and metadata (such as omitting the document creator) for official document compliance.
能力评估
Purpose & Capability
The name/description (produce China gov/central-enterprise Word docs) align with the included JavaScript library and the declared dependency on the 'docx' package. The package.json and package-lock show only docx and its normal transitive dependencies — appropriate for .docx generation.
Instruction Scope
SKILL.md instructs the agent/user to require and call functions from the included scripts/create_gov_doc.js and to write output files locally. Examples are limited to document construction and file output. Note: example require paths use a home-directory style ('~/.workbuddy/...') which is illustrative and may not resolve in all Node environments; otherwise the instructions do not ask the agent to read unrelated system files, network endpoints, or secrets.
Install Mechanism
This is instruction-only (no platform install spec). The bundle includes package.json and package-lock that declare the 'docx' npm dependency. Running the script requires a Node environment and installing dependencies (npm install). There is no external download/install URL or arbitrary installer code in the manifest — low installation risk but the runtime dependency must be installed before use.
Credentials
The skill requests no environment variables, no credentials, and no config paths. The code shown operates on supplied content and filesystem writes only; there are no references to cloud keys, tokens, or unrelated service credentials.
Persistence & Privilege
The skill is not marked always:true and does not request elevated or persistent platform privileges. Its behavior is limited to creating and writing .docx files in the run context; nothing in the manifest indicates it modifies other skills or global agent settings.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install gov-doc-writing
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /gov-doc-writing 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.6.0
- Added detailed documentation for creating Word documents aligned with Chinese government and central enterprise standards, including full style, margin, font, and formatting specifications. - Provided example usage via JavaScript API and CLI, with step-by-step code samples. - Documented table and image formatting rules in detail, specifying style names, color schema, vertical/horizontal alignment, and line spacing. - Clarified document property requirements (e.g., removing author metadata, page numbering, no cover page). - Included tips on font size conversions, text normalization, and style application for compliant output. - Listed core script location and modular functions for integrating skill in automation workflows.
元数据
Slug gov-doc-writing
版本 1.6.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

国央企word文档 是什么?

此技能用于创建符合中国政府及央企规范的Word文档(.docx)。当用户要求创建公文、国央企文档、规范文书、正式报告等需要特定中国公文格式的文档时使用此技能。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 62 次。

如何安装 国央企word文档?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install gov-doc-writing」即可一键安装,无需额外配置。

国央企word文档 是免费的吗?

是的,国央企word文档 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

国央企word文档 支持哪些平台?

国央企word文档 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 国央企word文档?

由 刘洪亮Leo(@a-lhliang)开发并维护,当前版本 v1.6.0。

💬 留言讨论