使用 PptxGenJS 将 HTML 文本字符串转换为 pptx 幻灯片

Converting HTML text string to pptx slide using PptxGenJS

如何翻译 HTML 字符串(不是 table!)格式,例如:

"<p><strong>Spend</strong></p><ul><li>Media spend: 963 889 SEK</li<li>Avarage vCPM: 47,58 SEK</li><li>SPA (step 1): 45,55 SEK</li><li>Budget CTC: 1 085 594 SEK</li></ul>"

使用 PptxGenJS 与 HTML 样式相同的 pptx 幻灯片?

我找到了解决方案 - https://github.com/it-beyondit/html2pptxgenjs。现在我会尝试在我的项目中使用它


更新:是的,这是完美的解决方案!

import {htmlToPptxText} from 'html2pptxgenjs';

const items = htmlToPptxText(data.value);

slide.addText(items, {
    x: data.x * blockWidth,
    y: 0,
    w: 1 * blockWidth,
    h: 1 * blockHeight,
    valign: 'middle',
    color: '000000',
    margin: 1,
});