Skip to content

Commit 93bb22f

Browse files
committed
chore(test): use hyperlinks in tables; see #171
1 parent 5134ae1 commit 93bb22f

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import Automizer from '../src/automizer';
2+
import { ChartData, modify } from '../src';
3+
4+
test('insert a table with pptxgenjs on a template slide', async () => {
5+
const automizer = new Automizer({
6+
templateDir: `${__dirname}/pptx-templates`,
7+
outputDir: `${__dirname}/pptx-output`,
8+
});
9+
10+
const pres = automizer
11+
.loadRoot(`RootTemplate.pptx`)
12+
.load(`EmptySlide.pptx`, 'empty');
13+
14+
pres.addSlide('empty', 1, (slide) => {
15+
// Use pptxgenjs to add a table from scratch:
16+
slide.generate((pptxGenJSSlide) => {
17+
const rowsTest = [
18+
[
19+
{ text: "Top Lft", options: { hyperlink: { url: 'https://duckduckgo.com' } }, },
20+
{ text: "Top Ctr", },
21+
{ text: "Top Rgt", },
22+
],
23+
[
24+
{ text: "Bot Lft", },
25+
{ text: "Bot Ctr", },
26+
{ text: "Bot Rgt", },
27+
],
28+
];
29+
30+
pptxGenJSSlide.addTable(rowsTest, { w: 9, rowH: 2, align: "left", fontFace: "Arial" });
31+
}, 'custom object name');
32+
});
33+
34+
const result = await pres.write(`generate-pptxgenjs-table.test.pptx`);
35+
36+
expect(result.slides).toBe(2);
37+
});
2.01 KB
Binary file not shown.

0 commit comments

Comments
 (0)