Skip to content

Maxpsc/ppt

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

@ppt/builder

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 -S
import { 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/              # 工具函数

相关文档

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors