PPT 导出引擎 —— 低码 Schema 到 PPT 产物的中间 DSL
@ppt/builder 是 PPT 导出引擎,负责将设计器产出的 Schema 协议转换为标准的 .pptx 文件。
注意:本包无法单独使用,它是低代码平台 PPT 导出流程中的中间环节,用于将低码 Schema DSL 转换为 pptxgenjs 可识别的 PPT 产物。
- Schema 协议解析
- PPT 元素转换(文本、图片、形状、图表、表格、线条)
- 字体嵌入支持
- 文件生成和导出
设计器 Schema → @ppt/builder → .pptx 文件
- pptxgenjs-pro: PPT 文件生成
- html-to-json-parser: HTML 富文本解析
- svg-pathdata: SVG 路径处理
- tinycolor2: 颜色处理
npm i @ppt/builder -Simport { PPTBuilder } from '@ppt/builder'
const builder = new PPTBuilder({
componentConfigList: [...],
elementConfigList: [...],
getElementTypeFromSchemaComp: (comp) => comp.type
})
await builder.exportPPT(designerData, {
fileName: 'presentation.pptx'
})builder/
├── src/
│ ├── builder.ts # 核心导出类
│ ├── schema.ts # Schema 类型定义
│ ├── types.ts # PPT 元素类型定义
│ ├── elements/ # 元素转换器
│ │ ├── text/
│ │ ├── image/
│ │ ├── shape/
│ │ ├── chart/
│ │ ├── table/
│ │ └── line/
│ └── utils/ # 工具函数