Skip to content

Commit d17d6e3

Browse files
author
Tom Choi
committed
merge master
1 parent 8fb9d48 commit d17d6e3

17 files changed

+1031
-898
lines changed

CHANGELOG.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,29 @@ jsdoc details for everything other than charts (maybe next time...)
1111
- Lots of poorly named options have been deprecated and new, much better names created
1212
- Unfotunately, `fill` no longer accepts a plain string and there was no smooth way to make that backwards compatible (sorry!)
1313

14-
## [3.3.0] - 2020-??-??
14+
## [3.3.0] - 2020-07-??
1515
### BREAKING CHANGES
1616
- **TypeScript users**: `fill` property no longer accepts strings, only `ShapeFill` type now (sorry!)
17+
- **All Users**: table and textbox text may break differently after a major rewrite to correct long-standing issues with alignment/breakLine, etc.
1718
### Added
1819
- Added: Auto-Paging finally comes to `addTable()` [\#262](https://github.com/gitbrent/PptxGenJS/issues/262) ([okaiyong](https://github.com/okaiyong))
1920
- Added: Chart DataTable formatting `dataTableFormatCode` and `valLabelFormatCode` [\#489](https://github.com/gitbrent/PptxGenJS/issues/489)[phobos7000](https://github.com/phobos7000)) [\#684](https://github.com/gitbrent/PptxGenJS/pull/684)[hanzi](https://github.com/hanzi))
2021
- Added: Background image for slides (deprecated `bkgd:string` with `background:BkgdOpts`) [\#610](https://github.com/gitbrent/PptxGenJS/pull/610) ([thomasowow](https://github.com/thomasowow))
22+
- Added: `shapeName` to objects instead of default [\#724](https://github.com/gitbrent/PptxGenJS/issues/724)[Offbeatmammal](https://github.com/Offbeatmammal))
23+
- Added: valAxisDisplayUnitLabel Option [\#765](https://github.com/gitbrent/PptxGenJS/pull/765)[hysh](https://github.com/hysh))
2124
### Changed
25+
- Aded: Set a hyperlink on a shape [\#767](https://github.com/gitbrent/PptxGenJS/issues/767)[CroniD](https://github.com/CroniD))
26+
- Fixed: complete rewrite of genXmlTextBody for new text run/paragraph generation. Fixes: [\#369](https://github.com/gitbrent/PptxGenJS/issues/369)
27+
[\#448](https://github.com/gitbrent/PptxGenJS/issues/448), [\#460](https://github.com/gitbrent/PptxGenJS/issues/460), [\#751](https://github.com/gitbrent/PptxGenJS/issues/751), [\#772](https://github.com/gitbrent/PptxGenJS/pull/772)
2228
- Fixed: tableToSlides `addHeaderToEach` finally duplicates all header rows, not just the first one [\#262](https://github.com/gitbrent/PptxGenJS/issues/262) ([okaiyong](https://github.com/okaiyong))
2329
- Fixed `colW` length mismatch with colspans (Issue #651) [\#679](https://github.com/gitbrent/PptxGenJS/issues/679) ([Joshua-rose](https://github.com/Joshua-rose))
2430
- Fixed: hyperlink and tooltip property `rId` is not working? [\#758](https://github.com/gitbrent/PptxGenJS/issues/758) ([kuldeept70](https://github.com/kuldeept70))
25-
- Fixed: Removed old/unused options from demo [\#759](https://github.com/gitbrent/PptxGenJS/pull/759) ([sijmenvos](https://github.com/sijmenvos))
26-
- Fixed: Removed `Buffer` type from `index.ts.d` [\#761](https://github.com/gitbrent/PptxGenJS/pull/761) ([lustigerlurch551](https://github.com/lustigerlurch551))
27-
-
31+
- Fixed: removed old/unused options from demo [\#759](https://github.com/gitbrent/PptxGenJS/pull/759) ([sijmenvos](https://github.com/sijmenvos))
32+
- Fixed: removed `Buffer` type from `index.ts.d` [\#761](https://github.com/gitbrent/PptxGenJS/pull/761) ([lustigerlurch551](https://github.com/lustigerlurch551))
33+
- Fixed: addSection does not escape XML unsafe characters [\#774](https://github.com/gitbrent/PptxGenJS/issues/774) ([pimlottc-gov](https://github.com/pimlottc-gov))
34+
- Fixed: Multiple Border Types not supported in Table Cell [\#775](https://github.com/gitbrent/PptxGenJS/issues/775) ([jsvishal](https://github.com/jsvishal))
35+
- Fixed: EMU calculations are not safe (calcPointValue in gen-xml) [\#781](https://github.com/gitbrent/PptxGenJS/issues/781) ([CroniD](https://github.com/CroniD))
36+
- ...
2837
- Fixed: type defs for `TableCell.text` not correct ([gitbrent](https://github.com/gitbrent))
2938
- Fixed: type defs for `ITableOptions` s/b `TableOptions` ([gitbrent](https://github.com/gitbrent))
3039
### WIP

demos/common/demos.js

Lines changed: 39 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* DESC: Common test/demo slides for all library features
55
* DEPS: Used by various demos (./demos/browser, ./demos/node, etc.)
66
* VER.: 3.3.0
7-
* BLD.: 20200621
7+
* BLD.: 20200629
88
*/
99

1010
var isIE11 = typeof window !== 'undefined' && !!window['MSInputMethodContext'] && !!document['documentMode'];
@@ -287,7 +287,7 @@ function genSlides_Table(pptx) {
287287
slide.addTable( [ [{ text:'Table Examples 1', options:gOptsTextL },gOptsTextR] ], gOptsTabOpts );
288288

289289
// DEMO: align/valign -------------------------------------------------------------------------
290-
var objOpts1 = { x:0.5, y:0.7, w:4, fontSize:18, fontFace:'Arial', color:'0088CC' };
290+
var objOpts1 = { x:0.5, y:0.7, w:4, h:0.3, margin:0, fontSize:18, fontFace:'Arial', color:'0088CC' };
291291
slide.addText('Cell Text Alignment:', objOpts1);
292292

293293
var arrTabRows = [
@@ -313,7 +313,7 @@ function genSlides_Table(pptx) {
313313
// Pass default cell style as tabOpts, then just style/override individual cells as needed
314314

315315
// DEMO: cell styles --------------------------------------------------------------------------
316-
var objOpts2 = { x:6.0, y:0.7, w:4, fontSize:18, fontFace:'Arial', color:'0088CC' };
316+
var objOpts2 = { x:6.0, y:0.7, w:4, h:0.3, margin:0, fontSize:18, fontFace:'Arial', color:'0088CC' };
317317
slide.addText('Cell Styles:', objOpts2);
318318

319319
var arrTabRows = [
@@ -338,7 +338,7 @@ function genSlides_Table(pptx) {
338338
);
339339

340340
// DEMO: Row/Col Width/Heights ----------------------------------------------------------------
341-
var objOpts3 = { x:0.5, y:3.6, fontSize:18, fontFace:'Arial', color:'0088CC' };
341+
var objOpts3 = { x:0.5, y:3.6, h:0.3, margin:0, fontSize:18, fontFace:'Arial', color:'0088CC' };
342342
slide.addText('Row/Col Heights/Widths:', objOpts3);
343343

344344
var arrTabRows = [
@@ -482,11 +482,11 @@ function genSlides_Table(pptx) {
482482
var optsSub = JSON.parse(JSON.stringify(gOptsSubTitle));
483483
slide.addText('Cell Margins:', optsSub);
484484

485-
slide.addTable( [['margin:0']], { x:0.5, y:1.1, margin:0, w:1.2, fill:'FFFCCC' } );
486-
slide.addTable( [['margin:[0,0,0,20]']], { x:2.5, y:1.1, margin:[0,0,0,20], w:2.0, fill:'FFFCCC', align:'right' } );
487-
slide.addTable( [['margin:5']], { x:5.5, y:1.1, margin:5, w:1.0, fill:'F1F1F1' } );
488-
slide.addTable( [['margin:[40,5,5,20]']], { x:7.5, y:1.1, margin:[40,5,5,20], w:2.2, fill:'F1F1F1' } );
489-
slide.addTable( [['margin:[30,5,5,30]']], { x:10.5,y:1.1, margin:[30,5,5,30], w:2.2, fill:'F1F1F1' } );
485+
slide.addTable([['margin:0']], { x: 0.5, y: 1.1, margin: 0, w: 1.2, fill: 'FFFCCC', border: { pt: 0 } });
486+
slide.addTable([['margin:[0,0,0,20]']], { x: 2.5, y: 1.1, margin: [0, 0, 0, 20], w: 2.0, fill: 'FFFCCC', align: 'right' });
487+
slide.addTable([['margin:5']], { x: 5.5, y: 1.1, margin: 5, w: 1.0, fill: pptx.SchemeColor.background2 });
488+
slide.addTable([['margin:[40,5,5,20]']], { x: 7.5, y: 1.1, margin: [40, 5, 5, 20], w: 2.2, fill: 'F1F1F1' });
489+
slide.addTable([['margin:[30,5,5,30]']], { x: 10.5, y: 1.1, margin: [30, 5, 5, 30], w: 2.2, fill: 'F1F1F1' });
490490

491491
slide.addTable( [[{text:'no border and number zero', options:{margin:5}}, {text:0, options:{margin:5}}]], { x:0.5, y:1.9, fill:'f2f9fc', border:{type:'none'}, colW:[2.5,0.5] } );
492492
slide.addTable( [[{text:'text-obj margin:0', options:{margin:0}}]], { x:4.0, y:1.9, w:2, fill:'f2f9fc' } );
@@ -504,9 +504,11 @@ function genSlides_Table(pptx) {
504504

505505
// Complex/Compound border
506506
var optsSub = JSON.parse(JSON.stringify(gOptsSubTitle)); optsSub.y = 3.9;
507-
slide.addText('Complex Cell Border:', optsSub);
508-
var arrBorder = [ {color:'FF0000',pt:1}, {color:'00ff00',pt:3}, {color:'0000ff',pt:5}, {color:'9e9e9e',pt:7} ];
509-
slide.addTable( [['Borders!']], { x:0.5, y:4.3, w:12.3, rowH:1.5, fill:'F5F5F5', color:'3D3D3D', fontSize:18, border:arrBorder, align:'center', valign:'middle' } );
507+
slide.addText('Complex Cell Borders:', optsSub);
508+
var arrBorder1 = [{ color: 'FF0000', pt: 1 }, { color: '00ff00', pt: 3 }, { color: '0000ff', pt: 5 }, { color: '9e9e9e', pt: 7 }];
509+
slide.addTable([['Borders 4!']], { x: 0.50, y: 4.3, w: 6, rowH: 1.5, fill: pptx.SchemeColor.background2, color: '3D3D3D', fontSize: 18, border: arrBorder1, align: 'center', valign: 'middle' });
510+
var arrBorder2 = [{ type: 'dash', color: 'ff0000', pt: 2 }, null, { type: 'dash', color: '0000ff', pt: 5 }, null];
511+
slide.addTable([['Borders 2!']], { x: 6.75, y: 4.3, w: 6, rowH: 1.5, fill: pptx.SchemeColor.background2, color: '3D3D3D', fontSize: 18, border: arrBorder2, align: 'center', valign: 'middle' });
510512

511513
// Invalid char check
512514
var optsSub = JSON.parse(JSON.stringify(gOptsSubTitle)); optsSub.y = 6.1;
@@ -526,27 +528,27 @@ function genSlides_Table(pptx) {
526528
{ x:0.5, y:0.5, w:'95%', h:0.5, margin:0.1, fontSize:14 }
527529
);
528530
slide.addText("[\n"
529-
+ " { text:'1st line', options:{ fontSize:24, color:'99ABCC', align:'right', breakLine:true } },\n"
531+
+ " { text:'1st line', options:{ fontSize:24, color:'99ABCC', align:'right', breakLine:true } },\n"
530532
+ " { text:'2nd line', options:{ fontSize:36, color:'FFFF00', align:'center', breakLine:true } },\n"
531-
+ " { text:'3rd line', options:{ fontSize:48, color:'0088CC', align:'left' } }\n"
533+
+ " { text:'3rd line', options:{ fontSize:48, color:'0088CC', align:'left' } }\n"
532534
+ "]",
533-
{ x:1, y:1.1, w:11, h:1.5, margin:0.1, fontFace:'Courier', fontSize:13, fill:'F1F1F1', color:'333333' }
535+
{ x:1, y:1.1, w:11, h:1.25, margin:0.1, fontFace:'Courier', fontSize:13, fill:'F1F1F1', color:'333333' }
534536
);
535537

536538
// Textbox: Text word-level formatting
537-
slide.addText('Textbox:', { x:1, y:2.8, w:3, fontSize:18, fontFace:'Arial', color:'0088CC' });
539+
slide.addText('Textbox:', { x:1, y:2.8, w:3, h:2, fontSize:18, fontFace:'Arial', color:'0088CC' });
538540

539541
var arrTextObjects = [
540542
{ text:'1st line', options:{ fontSize:24, color:'99ABCC', align:'right', breakLine:true } },
541543
{ text:'2nd line', options:{ fontSize:36, color:'FFFF00', align:'center', breakLine:true } },
542544
{ text:'3rd line', options:{ fontSize:48, color:'0088CC', align:'left' } }
543545
];
544-
slide.addText( arrTextObjects, { x:2.5, y:2.8, w:9, h:2, margin:0.1, fill:'232323' } );
546+
slide.addText( arrTextObjects, { x:2.5, y:2.8, w:9.5, h:2, margin:0.1, fill:'232323' } );
545547

546548
// Table cell: Use the exact same code from addText to do the same word-level formatting within a cell
547-
slide.addText('Table:', { x:1, y:5, w:3, fontSize:18, fontFace:'Arial', color:'0088CC' });
549+
slide.addText('Table:', { x:1, y:5, w:3, h:2, fontSize:18, fontFace:'Arial', color:'0088CC' });
548550

549-
var opts2 = { x:2.5, y:5, h:2, align:'center', valign:'middle', colW:[1.5,1.5,6], border:{pt:'1'}, fill:'F1F1F1' }
551+
var opts2 = { x:2.5, y:5, h:2, align:'center', valign:'middle', colW:[1.5,1.5,6.5], border:{pt:'1'}, fill:'F1F1F1' }
550552
var arrTabRows = [
551553
[
552554
{ text:'Cell 1A', options:{fontFace:'Arial' } },
@@ -654,13 +656,13 @@ function genSlides_Table(pptx) {
654656
pptx.addSection({ title: 'Tables: Auto-Paging Repeat Header' });
655657
var slide = pptx.addSlide({sectionTitle:'Tables: Auto-Paging Repeat Header'});
656658
slide.addText( [{text:'Table Examples: autoPageHeaderRows', options:gDemoTitleTextBk},{text:'no autoPageHeaderRows', options:gDemoTitleOpts}], {x:0.23, y:0.13, w:4, h:0.4} );
657-
slide.addTable( arrRowsHead1, { x:0.23, y:0.6, colW:[0.5, 1.0, 2.5], margin:5, border:{color:'CFCFCF'}, autoPage:true, autoPageRepeatHeader:true } );
659+
slide.addTable( arrRowsHead1, { x:0.23, y:0.6, colW:[0.5, 1.0, 2.5], margin:5, border:{color:'CFCFCF'}, autoPage:true, autoPageRepeatHeader:true, autoPageSlideStartY:0.6 } );
658660

659661
slide.addText( [{text:'Table Examples: autoPageHeaderRows', options:gDemoTitleTextBk},{text:'autoPageHeaderRows:1', options:gDemoTitleOpts}], {x:4.75, y:0.13, w:4, h:0.4} );
660-
slide.addTable( arrRowsHead1, { x:4.75, y:0.6, colW:[0.5, 1.0, 2.5], margin:5, border:{color:'CFCFCF'}, autoPage:true, autoPageRepeatHeader:true, autoPageHeaderRows:1 } );
662+
slide.addTable( arrRowsHead1, { x:4.75, y:0.6, colW:[0.5, 1.0, 2.5], margin:5, border:{color:'CFCFCF'}, autoPage:true, autoPageRepeatHeader:true, autoPageHeaderRows:1, autoPageSlideStartY:0.6 } );
661663

662664
slide.addText( [{text:'Table Examples: autoPageHeaderRows', options:gDemoTitleTextBk},{text:'autoPageHeaderRows:2', options:gDemoTitleOpts}], {x:9.10, y:0.13, w:4, h:0.4} );
663-
slide.addTable( arrRowsHead2, { x:9.10, y:0.6, colW:[0.5, 1.0, 2.5], margin:5, border:{color:'CFCFCF'}, autoPage:true, autoPageRepeatHeader:true, autoPageHeaderRows:2 } );
665+
slide.addTable( arrRowsHead2, { x:9.10, y:0.6, colW:[0.5, 1.0, 2.5], margin:5, border:{color:'CFCFCF'}, autoPage:true, autoPageRepeatHeader:true, autoPageHeaderRows:2, autoPageSlideStartY:0.6 } );
664666

665667
// autoPageLineWeight option demos
666668
pptx.addSection({ title: 'Tables: Auto-Paging LineWeight' });
@@ -935,6 +937,7 @@ function genSlides_Chart(pptx) {
935937
catAxisHidden: true,
936938
catGridLine : { style: 'none' },
937939
valAxisHidden: true,
940+
valAxisDisplayUnitLabel: true,
938941
valGridLine : { style: 'none' },
939942

940943
showLegend: true,
@@ -963,6 +966,7 @@ function genSlides_Chart(pptx) {
963966
valAxisOrientation: 'maxMin',
964967
valGridLine: { style: 'none' },
965968
valAxisHidden: true,
969+
valAxisDisplayUnitLabel: true,
966970
catGridLine: { color: 'cc6699', style: 'dash', size: 1 },
967971

968972
titleColor : '33CF22',
@@ -2642,8 +2646,8 @@ function genSlides_Shape(pptx) {
26422646
slide.addShape(pptx.shapes.LINE, { x: 4.2, y: 5.6, w: 5.0, h: 0.0, line: { color: 'FF0000', width: 4, beginArrowType: 'diamond', endArrowType: 'oval' } });
26432647
slide.addShape(pptx.shapes.LINE, { x: 5.7, y: 3.3, w: 2.5, h: 0.0, line: { width: 1 }, rotate: (360 - 45) }); // DIAGONAL Line // TEST:no line.color
26442648
slide.addShape(pptx.shapes.LINE, { sId: 3, x: 2, y: 1, w: 1, h: 0.0, line: { width: 1, sourceId: 1, targetId: 2, sourceAnchorPos: 0, targetAnchorPos: 1 } });
2645-
//
2646-
slide.addShape(pptx.shapes.RIGHT_TRIANGLE, { x: 0.4, y: 4.3, w: 6.0, h: 3.0, fill: { color: '0088CC' }, line: { color: '000000', width: 3 } });
2649+
//
2650+
slide.addShape(pptx.shapes.RIGHT_TRIANGLE, { x: 0.4, y: 4.3, w: 6.0, h: 3.0, fill: { color: '0088CC' }, line: { color: '000000', width: 3 }, shapeName:'First Right Triangle' });
26472651
slide.addShape(pptx.shapes.RIGHT_TRIANGLE, { x: 7.0, y: 4.3, w: 6.0, h: 3.0, fill: { color: '0088CC' }, line: { color: '000000', width: 2 }, flipH: true });
26482652

26492653
// SLIDE 2: Misc Shape Types with Text
@@ -2665,7 +2669,7 @@ function genSlides_Shape(pptx) {
26652669
slide.addText('DIAGONAL', { shape: pptx.shapes.LINE, valign: 'bottom', x: 5.7, y: 3.3, w: 2.5, h: 0, line: { width: 2 }, rotate:(360-45) }); // TEST: (missing `line.color`)
26662670
//
26672671
slide.addText('RIGHT-TRIANGLE', { shape: pptx.shapes.RIGHT_TRIANGLE, align: 'center', x: 0.4, y: 4.3, w: 6, h: 3, fill: { color: '0088CC' }, line: { color: '000000', width: 3 } });
2668-
slide.addText('RIGHT-TRIANGLE', { shape: pptx.shapes.RIGHT_TRIANGLE, align: 'center', x: 7.0, y: 4.3, w: 6, h: 3, fill: { color: '0088CC' }, line: { color: '000000', width: 2 }, flipH: true });
2672+
slide.addText('HYPERLINK-SHAPE', { shape: pptx.shapes.RIGHT_TRIANGLE, align: 'center', x: 7.0, y: 4.3, w: 6, h: 3, fill: { color: '0088CC' }, line: { color: '000000', width: 2 }, flipH: true, hyperlink: { url: "https://github.com/gitbrent/pptxgenjs", tooltip: "Visit Homepage" }, });
26692673
}
26702674

26712675
function genSlides_Text(pptx) {
@@ -2683,17 +2687,21 @@ function genSlides_Text(pptx) {
26832687

26842688
// Actual Textbox shape (can have any Height, can wrap text, etc.)
26852689
slide.addText([
2686-
{ text:'Textbox align (center/middle)', options:{ fontSize:32 } },
2690+
{ text:'Textbox align (center/middle)', options:{ fontSize:32, breakLine:true } },
26872691
{ text:'Character Spacing 16', options:{ fontSize:16, charSpacing:16 } }
26882692
],
26892693
{ x:0.5, y:0.75, w:8.5, h:2.5, color:'FFFFFF', fill:'0000FF', valign:'middle', align:'center', isTextBox:true }
26902694
);
2691-
slide.addText(
2692-
[{ text:'(left/top)', options:{ fontSize:12 } }, { text:'Textbox', options:{ bold:true } }],
2695+
slide.addText([
2696+
{ text: '(left/top)', options: { fontSize: 12, breakLine:true } },
2697+
{ text: 'Textbox', options: { bold: true } }
2698+
],
26932699
{ x:10, y:0.75, w:3.0, h:1.0, color:'FFFFFF', fill:'00CC00', valign:'top', align:'left', margin:15 }
26942700
);
2695-
slide.addText(
2696-
[{ text:'Textbox' }, { text:'(right/bottom)', options:{ fontSize:12 } }],
2701+
slide.addText([
2702+
{ text: 'Textbox', breakLine: true },
2703+
{ text: '(right/bottom)', options: { fontSize: 12 } }
2704+
],
26972705
{ x:10, y:2.25, w:3.0, h:1.0, color:'FFFFFF', fill:'FF0000', valign:'bottom', align:'right', margin:0 }
26982706
);
26992707

@@ -2748,7 +2756,7 @@ function genSlides_Text(pptx) {
27482756
{ text:'Verdana 48', options:{ fontSize:48, fontFace:'Verdana', color:pptx.colors.ACCENT3, align:'left', breakLine:true } },
27492757
{ text:'Strikethrough', options:{ fontSize:36, fontFace:'Arial', color:pptx.colors.ACCENT6, align:'center', strike:true, breakLine:true } },
27502758
{ text:'Underline', options:{ fontSize:36, fontFace:'Arial', color:pptx.colors.ACCENT4, align:'center', underline:true, breakLine:true } },
2751-
{ text:'\nTimes 36', options:{ fontSize:36, fontFace:'Times', color:pptx.colors.ACCENT5, align:'right', breakLine:true } }
2759+
{ text:'\nTimes 36', options:{ fontSize:36, fontFace:'Times', color:pptx.colors.ACCENT5, align:'right' } }
27522760
],
27532761
{ x:0.5, y:1.0, w:5.75, h:6.0, margin:5, fill:pptx.colors.TEXT1 }
27542762
);

dist/pptxgen.bundle.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/pptxgen.bundle.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)