文档

gongwen_format

试用

Skill for creating Chinese official documents (公文) following standardized formatting requirements. Use when user wants to create official documents such as n...

它能做什么

Skill for creating Chinese official documents (公文) following standardized formatting requirements. Use when user wants to create official documents such as notices, reports, decisions, or批复. Provides formatting templates based on GB/T 9704-2012 national standard and common enterprise standards.

技能文档

gongwen_format

技能说明 / Skill Description

This skill creates Chinese official documents (公文) following standardized formatting requirements based on:

  • GB/T 9704-2012: 党政机关公文格式国家标准
  • Common enterprise standards: 企业内部公文格式要求

公文格式规范 / Document Formatting Standards

字体规范 / Font Standards

元素字体字号粗体说明
标题方正小标宋简体二号多行标题行距38磅
正文方正仿宋三号行距28磅
一级标题方正黑体三号格式:"一、"
二级标题方正楷体三号格式:"(一)"
三级标题方正仿宋三号格式:"1." (不能用"1、")
四级标题方正仿宋三号格式:"(1)"
附件序号方正仿宋三号格式:"1." "2."

页面设置 / Page Settings

  • 纸张: A4 (210mm × 297mm)
  • 页边距: 上37mm,下35mm,左28mm,右26mm
  • 版心: 156mm × 225mm

标题行数 / Title Line Count

  • 单行标题: 居中,字号二号,加粗
  • 多行标题: 居中,字号二号,不加粗,行距38磅

创建公文 / Creating Official Documents

参考 references/gongwen_template.js 获取完整模板代码:

// 创建公文文档
const { Document, Packer, Paragraph, TextRun, AlignmentType, LineRuleType } = require('docx');
const fs = require('fs');

// 公文字体映射
const FONTS = {
  xiaobiaosong: '方正小标宋简体',  // 标题
  fangsong: '方正仿宋',            // 正文
  heiti: '方正黑体',              // 一级标题
  kaiti: '方正楷体',              // 二级标题
};

// 公文字号映射 (二号=22pt, 三号=16pt)
const SIZES = {
  erhao: 44,   // 二号 (22pt = 44 half-points)
  sanhao: 32,  // 三号 (16pt = 32 half-points)
};

const doc = new Document({
  sections: [{
    properties: {
      page: {
        size: { width: 11906, height: 16838 },  // A4 in DXA
        margin: { top: 1570, bottom: 1484, left: 1134, right: 1106 }
        // 对应: 上37mm, 下35mm, 左28mm, 右26mm
      }
    },
    children: [
      // 标题
      new Paragraph({
        alignment: AlignmentType.CENTER,
        children: [new TextRun({
          text: '关于XXXX的通知',
          font: FONTS.xiaobiaosong,
          size: SIZES.erhao,
        })],
        spacing: { line: 38 * 20, lineRule: LineRuleType.AUTO }
      }),
      // 正文...
    ]
  }]
});

Packer.toBuffer(doc).then(buffer => {
  fs.writeFileSync('gongwen.docx', buffer);
});

方法2: 使用 C# OpenXML SDK

参考 references/gongwen_template.cs 获取完整模板代码。


标题层级示例 / Heading Hierarchy Example

                                  [标题:方正小标宋简体 二号 居中]

一、一级标题(方正黑体 三号)
  (一)二级标题(方正楷体 三号)
    1. 三级标题(方正仿宋 三号)
      (1)四级标题(方正仿宋 三号)
        正文内容(方正仿宋 三号,行距28磅)

附件:
1. 附件一名称
2. 附件二名称

常见公文类型 / Common Document Types

类型英文用途
通知Notice发布规章、布置工作
报告Report向上级汇报工作
决定Decision对重要事项作出决策
批复Reply答复下级请示
Letter机关之间商洽工作
纪要Minutes记载会议情况

快速参考 / Quick Reference

字体安装提示

公文格式要求使用特定中文字体(方正系列)。如系统未安装:

  • Windows: 可从方正官网下载或使用替代字体
  • 替代方案: 华文系列字体可作为临时替代

常见错误

  1. 标题加粗 - 公文标题不应加粗
  2. 三级标题用"1、" - 应使用"1."格式
  3. 行距过密 - 正文行距应设置为28磅
  4. 页边距错误 - 应严格按照规范设置

参考资料 / References

  • references/gongwen_template.js - docx-js 公文模板
  • references/gongwen_template.cs - C# OpenXML 公文模板
  • references/gb9704_2012.md - GB/T 9704-2012 简要说明

相关技能

起草、改写或复核中文公文与正式工作材料,严守事实边界。

61 次安装1 星标

此技能用于创建符合中国政府及央企规范的Word文档(.docx)。当用户要求创建公文、国央企文档、规范文书、正式报告等需要特定中国公文格式的文档时使用此技能。公文字体(方正仿宋简体)可以自行下载。

26 次安装1 星标

Format, review, or rewrite Chinese official documents (公文) to the GB/T 9704-2012 党政机关公文格式 standard. The full rulebook is bundled in references/formatting_gui...

25 次安装

Convert uploaded Word documents (.docx) into the fixed Chinese official-document format defined by the bundled government-style template bundle. Use when Cod...

39 次安装1 星标

按读者、渠道和地区写出读起来像母语者写的中文,把语体、脚本、用词一起定好。

114 次安装3 星标

用 21 种版式与 22 种视觉风格自由组合生成信息图,并基于内容类型推荐搭配方案。

作者 Jim Liu 宝玉