美文网首页
pptxgenjs导出PPT

pptxgenjs导出PPT

作者: coderfl | 来源:发表于2023-04-18 14:02 被阅读0次
  • 安装

npm install pptxgenjs --save
yarn add pptxgenjs

<template>
  <el-button @click="exportPPT">导出</el-button>
</template>

<script>
import PptxGenJS from "pptxgenjs";

export default {
  name: "ppt",
  methods: {
    exportPPT() {
      // 1. Create a Presentation
      let pres = new PptxGenJS();

      // 2. Add a Slide to the presentation
      let slide = pres.addSlide();

      // 3. Add 1+ objects (Tables, Shapes, etc.) to the Slide
      slide.addText("Hello World from PptxGenJS...", {
        x: 1.5,
        y: 1.5,
        color: "363636",
        fill: { color: "F1F1F1" },
        align: pres.AlignH.center,
      });

      // 4. Save the Presentation
      pres.writeFile({ fileName: "Sample Presentation.pptx" });
    }
  },
}
</script>

官方文档:https://gitbrent.github.io/PptxGenJS/

相关文章

网友评论

      本文标题:pptxgenjs导出PPT

      本文链接:https://www.haomeiwen.com/subject/hnuhjdtx.html