File size: 47,968 Bytes
f56a29b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 | /* eslint-disable @typescript-eslint/no-explicit-any */
/**
* PptxGenJS Interfaces
*/
import { CHART_NAME, PLACEHOLDER_TYPE, SHAPE_NAME, SLIDE_OBJECT_TYPES, TEXT_HALIGN, TEXT_VALIGN, WRITE_OUTPUT_TYPE } from './core-enums'
// Core Types
// ==========
/**
* Coordinate number - either:
* - Inches (0-n)
* - Percentage (0-100)
*
* @example 10.25 // coordinate in inches
* @example '75%' // coordinate as percentage of slide size
*/
export type Coord = number | `${number}%`
export interface PositionProps {
/**
* Horizontal position
* - inches or percentage
* @example 10.25 // position in inches
* @example '75%' // position as percentage of slide size
*/
x?: Coord
/**
* Vertical position
* - inches or percentage
* @example 10.25 // position in inches
* @example '75%' // position as percentage of slide size
*/
y?: Coord
/**
* Height
* - inches or percentage
* @example 10.25 // height in inches
* @example '75%' // height as percentage of slide size
*/
h?: Coord
/**
* Width
* - inches or percentage
* @example 10.25 // width in inches
* @example '75%' // width as percentage of slide size
*/
w?: Coord
}
/**
* Either `data` or `path` is required
*/
export interface DataOrPathProps {
/**
* URL or relative path
*
* @example 'https://onedrives.com/myimg.png` // retrieve image via URL
* @example '/home/gitbrent/images/myimg.png` // retrieve image via local path
*/
path?: string
/**
* base64-encoded string
* - Useful for avoiding potential path/server issues
*
* @example 'image/png;base64,iVtDafDrBF[...]=' // pre-encoded image in base-64
*/
data?: string
}
export interface BackgroundProps extends DataOrPathProps, ShapeFillProps {
/**
* Color (hex format)
* @deprecated v3.6.0 - use `ShapeFillProps` instead
*/
fill?: HexColor
/**
* source URL
* @deprecated v3.6.0 - use `DataOrPathProps` instead - remove in v4.0.0
*/
src?: string
}
/**
* Color in Hex format
* @example 'FF3399'
*/
export type HexColor = string
export type ThemeColor = 'tx1' | 'tx2' | 'bg1' | 'bg2' | 'accent1' | 'accent2' | 'accent3' | 'accent4' | 'accent5' | 'accent6'
export type Color = HexColor | ThemeColor
export type Margin = number | [number, number, number, number]
export type HAlign = 'left' | 'center' | 'right' | 'justify'
export type VAlign = 'top' | 'middle' | 'bottom'
// used by charts, shape, text
export interface BorderProps {
/**
* Border type
* @default solid
*/
type?: 'none' | 'dash' | 'solid'
/**
* Border color (hex)
* @example 'FF3399'
* @default '666666'
*/
color?: HexColor
// TODO: add `transparency` prop to Borders (0-100%)
// TODO: add `width` - deprecate `pt`
/**
* Border size (points)
* @default 1
*/
pt?: number
}
// used by: image, object, text,
export interface HyperlinkProps {
_rId: number
/**
* Slide number to link to
*/
slide?: number
/**
* Url to link to
*/
url?: string
/**
* Hyperlink Tooltip
*/
tooltip?: string
}
// used by: chart, text, image
export interface ShadowProps {
/**
* shadow type
* @default 'none'
*/
type: 'outer' | 'inner' | 'none'
/**
* opacity (percent)
* - range: 0.0-1.0
* @example 0.5 // 50% opaque
*/
opacity?: number // TODO: "Transparency (0-100%)" in PPT // TODO: deprecate and add `transparency`
/**
* blur (points)
* - range: 0-100
* @default 0
*/
blur?: number
/**
* angle (degrees)
* - range: 0-359
* @default 0
*/
angle?: number
/**
* shadow offset (points)
* - range: 0-200
* @default 0
*/
offset?: number // TODO: "Distance" in PPT
/**
* shadow color (hex format)
* @example 'FF3399'
*/
color?: HexColor
/**
* whether to rotate shadow with shape
* @default false
*/
rotateWithShape?: boolean
}
// used by: shape, table, text
export interface ShapeFillProps {
/**
* Fill color
* - `HexColor` or `ThemeColor`
* @example 'FF0000' // hex color (red)
* @example pptx.SchemeColor.text1 // Theme color (Text1)
*/
color?: Color
/**
* Transparency (percent)
* - MS-PPT > Format Shape > Fill & Line > Fill > Transparency
* - range: 0-100
* @default 0
*/
transparency?: number
/**
* Fill type
* @default 'solid'
*/
type?: 'none' | 'solid'
/**
* Transparency (percent)
* @deprecated v3.3.0 - use `transparency`
*/
alpha?: number
}
export interface ShapeLineProps extends ShapeFillProps {
/**
* Line width (pt)
* @default 1
*/
width?: number
/**
* Dash type
* @default 'solid'
*/
dashType?: 'solid' | 'dash' | 'dashDot' | 'lgDash' | 'lgDashDot' | 'lgDashDotDot' | 'sysDash' | 'sysDot'
/**
* Begin arrow type
* @since v3.3.0
*/
beginArrowType?: 'none' | 'arrow' | 'diamond' | 'oval' | 'stealth' | 'triangle'
/**
* End arrow type
* @since v3.3.0
*/
endArrowType?: 'none' | 'arrow' | 'diamond' | 'oval' | 'stealth' | 'triangle'
// FUTURE: beginArrowSize (1-9)
// FUTURE: endArrowSize (1-9)
/**
* Dash type
* @deprecated v3.3.0 - use `dashType`
*/
lineDash?: 'solid' | 'dash' | 'dashDot' | 'lgDash' | 'lgDashDot' | 'lgDashDotDot' | 'sysDash' | 'sysDot'
/**
* @deprecated v3.3.0 - use `beginArrowType`
*/
lineHead?: 'none' | 'arrow' | 'diamond' | 'oval' | 'stealth' | 'triangle'
/**
* @deprecated v3.3.0 - use `endArrowType`
*/
lineTail?: 'none' | 'arrow' | 'diamond' | 'oval' | 'stealth' | 'triangle'
/**
* Line width (pt)
* @deprecated v3.3.0 - use `width`
*/
pt?: number
/**
* Line size (pt)
* @deprecated v3.3.0 - use `width`
*/
size?: number
}
// used by: chart, slide, table, text
export interface TextBaseProps {
/**
* Horizontal alignment
* @default 'left'
*/
align?: HAlign
/**
* Bold style
* @default false
*/
bold?: boolean
/**
* Add a line-break
* @default false
*/
breakLine?: boolean
/**
* Add standard or custom bullet
* - use `true` for standard bullet
* - pass object options for custom bullet
* @default false
*/
bullet?:
| boolean
| {
/**
* Bullet type
* @default bullet
*/
type?: 'bullet' | 'number'
/**
* Bullet character code (unicode)
* @since v3.3.0
* @example '25BA' // 'BLACK RIGHT-POINTING POINTER' (U+25BA)
*/
characterCode?: string
/**
* Indentation (space between bullet and text) (points)
* @since v3.3.0
* @default 27 // DEF_BULLET_MARGIN
* @example 10 // Indents text 10 points from bullet
*/
indent?: number
/**
* Number type
* @since v3.3.0
* @example 'romanLcParenR' // roman numerals lower-case with paranthesis right
*/
numberType?:
| 'alphaLcParenBoth'
| 'alphaLcParenR'
| 'alphaLcPeriod'
| 'alphaUcParenBoth'
| 'alphaUcParenR'
| 'alphaUcPeriod'
| 'arabicParenBoth'
| 'arabicParenR'
| 'arabicPeriod'
| 'arabicPlain'
| 'romanLcParenBoth'
| 'romanLcParenR'
| 'romanLcPeriod'
| 'romanUcParenBoth'
| 'romanUcParenR'
| 'romanUcPeriod'
/**
* Number bullets start at
* @since v3.3.0
* @default 1
* @example 10 // numbered bullets start with 10
*/
numberStartAt?: number
// DEPRECATED
/**
* Bullet code (unicode)
* @deprecated v3.3.0 - use `characterCode`
*/
code?: string
/**
* Margin between bullet and text
* @since v3.2.1
* @deplrecated v3.3.0 - use `indent`
*/
marginPt?: number
/**
* Number to start with (only applies to type:number)
* @deprecated v3.3.0 - use `numberStartAt`
*/
startAt?: number
/**
* Number type
* @deprecated v3.3.0 - use `numberType`
*/
style?: string
}
/**
* Text color
* - `HexColor` or `ThemeColor`
* - MS-PPT > Format Shape > Text Options > Text Fill & Outline > Text Fill > Color
* @example 'FF0000' // hex color (red)
* @example pptx.SchemeColor.text1 // Theme color (Text1)
*/
color?: Color
/**
* Font face name
* @example 'Arial' // Arial font
*/
fontFace?: string
/**
* Font size
* @example 12 // Font size 12
*/
fontSize?: number
/**
* Text highlight color (hex format)
* @example 'FFFF00' // yellow
*/
highlight?: HexColor
/**
* italic style
* @default false
*/
italic?: boolean
/**
* language
* - ISO 639-1 standard language code
* @default 'en-US' // english US
* @example 'fr-CA' // french Canadian
*/
lang?: string
/**
* Add a soft line-break (shift+enter) before line text content
* @default false
* @since v3.5.0
*/
softBreakBefore?: boolean
/**
* tab stops
* - PowerPoint: Paragraph > Tabs > Tab stop position
* @example [{ position:1 }, { position:3 }] // Set first tab stop to 1 inch, set second tab stop to 3 inches
*/
tabStops?: Array<{ position: number, alignment?: 'l' | 'r' | 'ctr' | 'dec' }>
/**
* text direction
* `horz` = horizontal
* `vert` = rotate 90^
* `vert270` = rotate 270^
* `wordArtVert` = stacked
* @default 'horz'
*/
textDirection?: 'horz' | 'vert' | 'vert270' | 'wordArtVert'
/**
* Transparency (percent)
* - MS-PPT > Format Shape > Text Options > Text Fill & Outline > Text Fill > Transparency
* - range: 0-100
* @default 0
*/
transparency?: number
/**
* underline properties
* - PowerPoint: Font > Color & Underline > Underline Style/Underline Color
* @default (none)
*/
underline?: {
style?:
| 'dash'
| 'dashHeavy'
| 'dashLong'
| 'dashLongHeavy'
| 'dbl'
| 'dotDash'
| 'dotDashHeave'
| 'dotDotDash'
| 'dotDotDashHeavy'
| 'dotted'
| 'dottedHeavy'
| 'heavy'
| 'none'
| 'sng'
| 'wavy'
| 'wavyDbl'
| 'wavyHeavy'
color?: Color
}
/**
* vertical alignment
* @default 'top'
*/
valign?: VAlign
}
export interface PlaceholderProps extends PositionProps, TextBaseProps {
name: string
type: PLACEHOLDER_TYPE
/**
* margin (points)
*/
margin?: Margin
}
export interface ObjectNameProps {
/**
* Object name
* - used instead of default "Object N" name
* - PowerPoint: Home > Arrange > Selection Pane...
* @since v3.10.0
* @default 'Object 1'
* @example 'Antenna Design 9'
*/
objectName?: string
}
export interface ThemeProps {
/**
* Headings font face name
* @example 'Arial Narrow'
* @default 'Calibri Light'
*/
headFontFace?: string
/**
* Body font face name
* @example 'Arial'
* @default 'Calibri'
*/
bodyFontFace?: string
}
// image / media ==================================================================================
export type MediaType = 'audio' | 'online' | 'video'
export interface ImageProps extends PositionProps, DataOrPathProps, ObjectNameProps {
/**
* Alt Text value ("How would you describe this object and its contents to someone who is blind?")
* - PowerPoint: [right-click on an image] > "Edit Alt Text..."
*/
altText?: string
/**
* Flip horizontally?
* @default false
*/
flipH?: boolean
/**
* Flip vertical?
* @default false
*/
flipV?: boolean
hyperlink?: HyperlinkProps
/**
* Placeholder type
* - values: 'body' | 'header' | 'footer' | 'title' | et. al.
* @example 'body'
* @see https://docs.microsoft.com/en-us/office/vba/api/powerpoint.ppplaceholdertype
*/
placeholder?: string
/**
* Image rotation (degrees)
* - range: -360 to 360
* @default 0
* @example 180 // rotate image 180 degrees
*/
rotate?: number
/**
* Enable image rounding
* @default false
*/
rounding?: boolean
/**
* Shadow Props
* - MS-PPT > Format Picture > Shadow
* @example
* { type: 'outer', color: '000000', opacity: 0.5, blur: 20, offset: 20, angle: 270 }
*/
shadow?: ShadowProps
/**
* Image sizing options
*/
sizing?: {
/**
* Sizing type
*/
type: 'contain' | 'cover' | 'crop'
/**
* Image width
* - inches or percentage
* @example 10.25 // position in inches
* @example '75%' // position as percentage of slide size
*/
w: Coord
/**
* Image height
* - inches or percentage
* @example 10.25 // position in inches
* @example '75%' // position as percentage of slide size
*/
h: Coord
/**
* Offset from left to crop image
* - `crop` only
* - inches or percentage
* @example 10.25 // position in inches
* @example '75%' // position as percentage of slide size
*/
x?: Coord
/**
* Offset from top to crop image
* - `crop` only
* - inches or percentage
* @example 10.25 // position in inches
* @example '75%' // position as percentage of slide size
*/
y?: Coord
}
/**
* Transparency (percent)
* - MS-PPT > Format Picture > Picture > Picture Transparency > Transparency
* - range: 0-100
* @default 0
* @example 25 // 25% transparent
*/
transparency?: number
}
/**
* Add media (audio/video) to slide
* @requires either `link` or `path`
*/
export interface MediaProps extends PositionProps, DataOrPathProps, ObjectNameProps {
/**
* Media type
* - Use 'online' to embed a YouTube video (only supported in recent versions of PowerPoint)
*/
type: MediaType
/**
* Cover image
* @since 3.9.0
* @default "play button" image, gray background
*/
cover?: string
/**
* media file extension
* - use when the media file path does not already have an extension, ex: "/folder/SomeSong"
* @since 3.9.0
* @default extension from file provided
*/
extn?: string
/**
* video embed link
* - works with YouTube
* - other sites may not show correctly in PowerPoint
* @example 'https://www.youtube.com/embed/Dph6ynRVyUc' // embed a youtube video
*/
link?: string
/**
* full or local path
* @example 'https://freesounds/simpsons/bart.mp3' // embed mp3 audio clip from server
* @example '/sounds/simpsons_haha.mp3' // embed mp3 audio clip from local directory
*/
path?: string
}
// formula =========================================================================================
/**
* Add a formula (Office Math / OMML) to slide
*/
export interface FormulaProps extends PositionProps, ObjectNameProps {
/**
* OMML XML string representing the formula
*/
omml: string
/**
* Font size for the formula (points)
*/
fontSize?: number
/**
* Font color (hex)
*/
color?: string
/**
* Horizontal alignment of the formula: 'left' | 'center' | 'right'
* @default 'center'
*/
align?: 'left' | 'center' | 'right'
}
// shapes =========================================================================================
export interface ShapeProps extends PositionProps, ObjectNameProps {
/**
* Horizontal alignment
* @default 'left'
*/
align?: HAlign
/**
* Radius (only for pptx.shapes.PIE, pptx.shapes.ARC, pptx.shapes.BLOCK_ARC)
* - In the case of pptx.shapes.BLOCK_ARC you have to setup the arcThicknessRatio
* - values: [0-359, 0-359]
* @since v3.4.0
* @default [270, 0]
*/
angleRange?: [number, number]
/**
* Radius (only for pptx.shapes.BLOCK_ARC)
* - You have to setup the angleRange values too
* - values: 0.0-1.0
* @since v3.4.0
* @default 0.5
*/
arcThicknessRatio?: number
/**
* Shape fill color properties
* @example { color:'FF0000' } // hex color (red)
* @example { color:'0088CC', transparency:50 } // hex color, 50% transparent
* @example { color:pptx.SchemeColor.accent1 } // Theme color Accent1
*/
fill?: ShapeFillProps
/**
* Flip shape horizontally?
* @default false
*/
flipH?: boolean
/**
* Flip shape vertical?
* @default false
*/
flipV?: boolean
/**
* Add hyperlink to shape
* @example hyperlink: { url: "https://github.com/gitbrent/pptxgenjs", tooltip: "Visit Homepage" },
*/
hyperlink?: HyperlinkProps
/**
* Line options
*/
line?: ShapeLineProps
/**
* Points (only for pptx.shapes.CUSTOM_GEOMETRY)
* - type: 'arc'
* - `hR` Shape Arc Height Radius
* - `wR` Shape Arc Width Radius
* - `stAng` Shape Arc Start Angle
* - `swAng` Shape Arc Swing Angle
* @see http://www.datypic.com/sc/ooxml/e-a_arcTo-1.html
* @example [{ x: 0, y: 0 }, { x: 10, y: 10 }] // draw a line between those two points
*/
points?: Array<
| { x: Coord, y: Coord, moveTo?: boolean }
| { x: Coord, y: Coord, curve: { type: 'arc', hR: Coord, wR: Coord, stAng: number, swAng: number } }
| { x: Coord, y: Coord, curve: { type: 'cubic', x1: Coord, y1: Coord, x2: Coord, y2: Coord } }
| { x: Coord, y: Coord, curve: { type: 'quadratic', x1: Coord, y1: Coord } }
| { close: true }
>
/**
* Rounded rectangle radius (only for pptx.shapes.ROUNDED_RECTANGLE)
* - values: 0.0 to 1.0
* @default 0
*/
rectRadius?: number
/**
* Rotation (degrees)
* - range: -360 to 360
* @default 0
* @example 180 // rotate 180 degrees
*/
rotate?: number
/**
* Shadow options
* TODO: need new demo.js entry for shape shadow
*/
shadow?: ShadowProps
/**
* @deprecated v3.3.0
*/
lineSize?: number
/**
* @deprecated v3.3.0
*/
lineDash?: 'dash' | 'dashDot' | 'lgDash' | 'lgDashDot' | 'lgDashDotDot' | 'solid' | 'sysDash' | 'sysDot'
/**
* @deprecated v3.3.0
*/
lineHead?: 'arrow' | 'diamond' | 'none' | 'oval' | 'stealth' | 'triangle'
/**
* @deprecated v3.3.0
*/
lineTail?: 'arrow' | 'diamond' | 'none' | 'oval' | 'stealth' | 'triangle'
/**
* Shape name (used instead of default "Shape N" name)
* @deprecated v3.10.0 - use `objectName`
*/
shapeName?: string
}
// tables =========================================================================================
export interface TableToSlidesProps extends TableProps {
_arrObjTabHeadRows?: TableRow[]
// _masterSlide?: SlideLayout
/**
* Add an image to slide(s) created during autopaging
* - `image` prop requires either `path` or `data`
* - see `DataOrPathProps` for details on `image` props
* - see `PositionProps` for details on `options` props
*/
addImage?: { image: DataOrPathProps, options: PositionProps }
/**
* Add a shape to slide(s) created during autopaging
*/
addShape?: { shapeName: SHAPE_NAME, options: ShapeProps }
/**
* Add a table to slide(s) created during autopaging
*/
addTable?: { rows: TableRow[], options: TableProps }
/**
* Add a text object to slide(s) created during autopaging
*/
addText?: { text: TextProps[], options: TextPropsOptions }
/**
* Whether to enable auto-paging
* - auto-paging creates new slides as content overflows a slide
* @default true
*/
autoPage?: boolean
/**
* Auto-paging character weight
* - adjusts how many characters are used before lines wrap
* - range: -1.0 to 1.0
* @see https://gitbrent.github.io/PptxGenJS/docs/api-tables.html
* @default 0.0
* @example 0.5 // lines are longer (increases the number of characters that can fit on a given line)
*/
autoPageCharWeight?: number
/**
* Auto-paging line weight
* - adjusts how many lines are used before slides wrap
* - range: -1.0 to 1.0
* @see https://gitbrent.github.io/PptxGenJS/docs/api-tables.html
* @default 0.0
* @example 0.5 // tables are taller (increases the number of lines that can fit on a given slide)
*/
autoPageLineWeight?: number
/**
* Whether to repeat head row(s) on new tables created by autopaging
* @since v3.3.0
* @default false
*/
autoPageRepeatHeader?: boolean
/**
* The `y` location to use on subsequent slides created by autopaging
* @default (top margin of Slide)
*/
autoPageSlideStartY?: number
/**
* Column widths (inches)
*/
colW?: number | number[]
/**
* Master slide name
* - define a master slide to have your auto-paged slides have corporate design, etc.
* @see https://gitbrent.github.io/PptxGenJS/docs/masters.html
*/
masterSlideName?: string
/**
* Slide margin
* - this margin will be across all slides created by auto-paging
*/
slideMargin?: Margin
/**
* @deprecated v3.3.0 - use `autoPageRepeatHeader`
*/
addHeaderToEach?: boolean
/**
* @deprecated v3.3.0 - use `autoPageSlideStartY`
*/
newSlideStartY?: number
}
export interface TableCellProps extends TextBaseProps {
/**
* Auto-paging character weight
* - adjusts how many characters are used before lines wrap
* - range: -1.0 to 1.0
* @see https://gitbrent.github.io/PptxGenJS/docs/api-tables.html
* @default 0.0
* @example 0.5 // lines are longer (increases the number of characters that can fit on a given line)
*/
autoPageCharWeight?: number
/**
* Auto-paging line weight
* - adjusts how many lines are used before slides wrap
* - range: -1.0 to 1.0
* @see https://gitbrent.github.io/PptxGenJS/docs/api-tables.html
* @default 0.0
* @example 0.5 // tables are taller (increases the number of lines that can fit on a given slide)
*/
autoPageLineWeight?: number
/**
* Cell border
*/
border?: BorderProps | [BorderProps, BorderProps, BorderProps, BorderProps]
/**
* Cell colspan
*/
colspan?: number
/**
* Fill color
* @example { color:'FF0000' } // hex color (red)
* @example { color:'0088CC', transparency:50 } // hex color, 50% transparent
* @example { color:pptx.SchemeColor.accent1 } // theme color Accent1
*/
fill?: ShapeFillProps
hyperlink?: HyperlinkProps
/**
* Cell margin (inches)
* @default 0
*/
margin?: Margin
/**
* Cell rowspan
*/
rowspan?: number
}
export interface TableProps extends PositionProps, TextBaseProps, ObjectNameProps {
_arrObjTabHeadRows?: TableRow[]
/**
* Whether to enable auto-paging
* - auto-paging creates new slides as content overflows a slide
* @default false
*/
autoPage?: boolean
/**
* Auto-paging character weight
* - adjusts how many characters are used before lines wrap
* - range: -1.0 to 1.0
* @see https://gitbrent.github.io/PptxGenJS/docs/api-tables.html
* @default 0.0
* @example 0.5 // lines are longer (increases the number of characters that can fit on a given line)
*/
autoPageCharWeight?: number
/**
* Auto-paging line weight
* - adjusts how many lines are used before slides wrap
* - range: -1.0 to 1.0
* @see https://gitbrent.github.io/PptxGenJS/docs/api-tables.html
* @default 0.0
* @example 0.5 // tables are taller (increases the number of lines that can fit on a given slide)
*/
autoPageLineWeight?: number
/**
* Whether table header row(s) should be repeated on each new slide creating by autoPage.
* Use `autoPageHeaderRows` to designate how many rows comprise the table header (1+).
* @default false
* @since v3.3.0
*/
autoPageRepeatHeader?: boolean
/**
* Number of rows that comprise table headers
* - required when `autoPageRepeatHeader` is set to true.
* @example 2 - repeats the first two table rows on each new slide created
* @default 1
* @since v3.3.0
*/
autoPageHeaderRows?: number
/**
* The `y` location to use on subsequent slides created by autopaging
* @default (top margin of Slide)
*/
autoPageSlideStartY?: number
/**
* Table border
* - single value is applied to all 4 sides
* - array of values in TRBL order for individual sides
*/
border?: BorderProps | [BorderProps, BorderProps, BorderProps, BorderProps]
/**
* Width of table columns (inches)
* - single value is applied to every column equally based upon `w`
* - array of values in applied to each column in order
* @default columns of equal width based upon `w`
*/
colW?: number | number[]
/**
* Cell background color
* @example { color:'FF0000' } // hex color (red)
* @example { color:'0088CC', transparency:50 } // hex color, 50% transparent
* @example { color:pptx.SchemeColor.accent1 } // theme color Accent1
*/
fill?: ShapeFillProps
/**
* Cell margin (inches)
* - affects all table cells, is superceded by cell options
*/
margin?: Margin
/**
* Height of table rows (inches)
* - single value is applied to every row equally based upon `h`
* - array of values in applied to each row in order
* @default rows of equal height based upon `h`
*/
rowH?: number | number[]
/**
* DEV TOOL: Verbose Mode (to console)
* - tell the library to provide an almost ridiculous amount of detail during auto-paging calculations
* @default false // obviously
*/
verbose?: boolean // Undocumented; shows verbose output
/**
* @deprecated v3.3.0 - use `autoPageSlideStartY`
*/
newSlideStartY?: number
}
export interface TableCell {
_type: SLIDE_OBJECT_TYPES.tablecell
/** lines in this cell (autoPage) */
_lines?: TableCell[][]
/** `text` prop but guaranteed to hold "TableCell[]" */
_tableCells?: TableCell[]
/** height in EMU */
_lineHeight?: number
_hmerge?: boolean
_vmerge?: boolean
_rowContinue?: number
_optImp?: any
text?: string | TableCell[] // TODO: FUTURE: 20210815: ONly allow `TableCell[]` dealing with string|TableCell[] *SUCKS*
options?: TableCellProps
}
export interface TableRowSlide {
rows: TableRow[]
}
export type TableRow = TableCell[]
// text ===========================================================================================
export interface TextGlowProps {
/**
* Border color (hex format)
* @example 'FF3399'
*/
color?: HexColor
/**
* opacity (0.0 - 1.0)
* @example 0.5
* 50% opaque
*/
opacity?: number
/**
* size (points)
*/
size: number
}
export interface TextPropsOptions extends PositionProps, DataOrPathProps, TextBaseProps, ObjectNameProps {
_bodyProp?: {
// Note: Many of these duplicated as user options are transformed to _bodyProp options for XML processing
autoFit?: boolean
align?: TEXT_HALIGN
anchor?: TEXT_VALIGN
lIns?: number
rIns?: number
tIns?: number
bIns?: number
vert?: 'eaVert' | 'horz' | 'mongolianVert' | 'vert' | 'vert270' | 'wordArtVert' | 'wordArtVertRtl'
wrap?: boolean
}
_lineIdx?: number
baseline?: number
/**
* Character spacing
*/
charSpacing?: number
/**
* Text fit options
*
* MS-PPT > Format Shape > Shape Options > Text Box > "[unlabeled group]": [3 options below]
* - 'none' = Do not Autofit
* - 'shrink' = Shrink text on overflow
* - 'resize' = Resize shape to fit text
*
* **Note** 'shrink' and 'resize' only take effect after editing text/resize shape.
* Both PowerPoint and Word dynamically calculate a scaling factor and apply it when edit/resize occurs.
*
* There is no way for this library to trigger that behavior, sorry.
* @since v3.3.0
* @default "none"
*/
fit?: 'none' | 'shrink' | 'resize'
/**
* Shape fill
* @example { color:'FF0000' } // hex color (red)
* @example { color:'0088CC', transparency:50 } // hex color, 50% transparent
* @example { color:pptx.SchemeColor.accent1 } // theme color Accent1
*/
fill?: ShapeFillProps
/**
* Flip shape horizontally?
* @default false
*/
flipH?: boolean
/**
* Flip shape vertical?
* @default false
*/
flipV?: boolean
glow?: TextGlowProps
hyperlink?: HyperlinkProps
indentLevel?: number
isTextBox?: boolean
line?: ShapeLineProps
/**
* Line spacing (pt)
* - PowerPoint: Paragraph > Indents and Spacing > Line Spacing: > "Exactly"
* @example 28 // 28pt
*/
lineSpacing?: number
/**
* line spacing multiple (percent)
* - range: 0.0-9.99
* - PowerPoint: Paragraph > Indents and Spacing > Line Spacing: > "Multiple"
* @example 1.5 // 1.5X line spacing
* @since v3.5.0
*/
lineSpacingMultiple?: number
// TODO: [20220219] powerpoint uses inches but library has always been pt... @future @deprecated - update in v4.0? [range: 0.0-22.0]
/**
* Margin (points)
* - PowerPoint: Format Shape > Shape Options > Size & Properties > Text Box > Left/Right/Top/Bottom margin
* @default "Normal" margin in PowerPoint [3.5, 7.0, 3.5, 7.0] // (this library sets no value, but PowerPoint defaults to "Normal" [0.05", 0.1", 0.05", 0.1"])
* @example 0 // Top/Right/Bottom/Left margin 0 [0.0" in powerpoint]
* @example 10 // Top/Right/Bottom/Left margin 10 [0.14" in powerpoint]
* @example [10,5,10,5] // Top margin 10, Right margin 5, Bottom margin 10, Left margin 5
*/
margin?: Margin
outline?: { color: Color, size: number }
paraSpaceAfter?: number
paraSpaceBefore?: number
placeholder?: string
/**
* Rounded rectangle radius (only for pptx.shapes.ROUNDED_RECTANGLE)
* - values: 0.0 to 1.0
* @default 0
*/
rectRadius?: number
/**
* Rotation (degrees)
* - range: -360 to 360
* @default 0
* @example 180 // rotate 180 degrees
*/
rotate?: number
/**
* Whether to enable right-to-left mode
* @default false
*/
rtlMode?: boolean
shadow?: ShadowProps
shape?: SHAPE_NAME
strike?: boolean | 'dblStrike' | 'sngStrike'
subscript?: boolean
superscript?: boolean
/**
* Vertical alignment
* @default middle
*/
valign?: VAlign
vert?: 'eaVert' | 'horz' | 'mongolianVert' | 'vert' | 'vert270' | 'wordArtVert' | 'wordArtVertRtl'
/**
* Text wrap
* @since v3.3.0
* @default true
*/
wrap?: boolean
/**
* Whether "Fit to Shape?" is enabled
* @deprecated v3.3.0 - use `fit`
*/
autoFit?: boolean
/**
* Whather "Shrink Text on Overflow?" is enabled
* @deprecated v3.3.0 - use `fit`
*/
shrinkText?: boolean
/**
* Inset
* @deprecated v3.10.0 - use `margin`
*/
inset?: number
/**
* Dash type
* @deprecated v3.3.0 - use `line.dashType`
*/
lineDash?: 'solid' | 'dash' | 'dashDot' | 'lgDash' | 'lgDashDot' | 'lgDashDotDot' | 'sysDash' | 'sysDot'
/**
* @deprecated v3.3.0 - use `line.beginArrowType`
*/
lineHead?: 'none' | 'arrow' | 'diamond' | 'oval' | 'stealth' | 'triangle'
/**
* @deprecated v3.3.0 - use `line.width`
*/
lineSize?: number
/**
* @deprecated v3.3.0 - use `line.endArrowType`
*/
lineTail?: 'none' | 'arrow' | 'diamond' | 'oval' | 'stealth' | 'triangle'
}
export interface TextProps {
text?: string
options?: TextPropsOptions
}
// charts =========================================================================================
// FUTURE: BREAKING-CHANGE: (soln: use `OptsDataLabelPosition|string` until 3.5/4.0)
/*
export interface OptsDataLabelPosition {
pie: 'ctr' | 'inEnd' | 'outEnd' | 'bestFit'
scatter: 'b' | 'ctr' | 'l' | 'r' | 't'
// TODO: add all othere chart types
}
*/
export type ChartAxisTickMark = 'none' | 'inside' | 'outside' | 'cross'
export type ChartLineCap = 'flat' | 'round' | 'square'
export interface OptsChartData {
_dataIndex?: number
/**
* category labels
* @example ['Year 2000', 'Year 2010', 'Year 2020'] // single-level category axes labels
* @example [['Year 2000', 'Year 2010', 'Year 2020'], ['Decades', '', '']] // multi-level category axes labels
* @since `labels` string[][] type added v3.11.0
*/
labels?: string[] | string[][]
/**
* series name
* @example 'Locations'
*/
name?: string
/**
* bubble sizes
* @example [5, 1, 5, 1]
*/
sizes?: number[]
/**
* category values
* @example [2000, 2010, 2020]
*/
values?: number[]
/**
* Override `chartColors`
*/
// color?: string // TODO: WIP: (Pull #727)
}
// Used internally, probably shouldn't be used by end users
export interface IOptsChartData extends OptsChartData {
labels?: string[][]
}
export interface OptsChartGridLine {
/**
* MS-PPT > Chart format > Format Major Gridlines > Line > Cap type
* - line cap type
* @default flat
*/
cap?: ChartLineCap
/**
* Gridline color (hex)
* @example 'FF3399'
*/
color?: HexColor
/**
* Gridline size (points)
*/
size?: number
/**
* Gridline style
*/
style?: 'solid' | 'dash' | 'dot' | 'none'
}
// TODO: 202008: chart types remain with predicated with "I" in v3.3.0 (ran out of time!)
export interface IChartMulti {
type: CHART_NAME
data: IOptsChartData[]
options: IChartOptsLib
}
export interface IChartPropsFillLine {
/**
* PowerPoint: Format Chart Area/Plot > Border ["Line"]
* @example border: {color: 'FF0000', pt: 1} // hex RGB color, 1 pt line
*/
border?: BorderProps
/**
* PowerPoint: Format Chart Area/Plot Area > Fill
* @example fill: {color: '696969'} // hex RGB color value
* @example fill: {color: pptx.SchemeColor.background2} // Theme color value
* @example fill: {transparency: 50} // 50% transparency
*/
fill?: ShapeFillProps
}
export interface IChartAreaProps extends IChartPropsFillLine {
/**
* Whether the chart area has rounded corners
* - only applies when either `fill` or `border` is used
* @default true
* @since v3.11
*/
roundedCorners?: boolean
}
export interface IChartPropsBase {
/**
* Axis position
*/
axisPos?: 'b' | 'l' | 'r' | 't'
chartColors?: HexColor[]
/**
* opacity (0 - 100)
* @example 50 // 50% opaque
*/
chartColorsOpacity?: number
dataBorder?: BorderProps
displayBlanksAs?: string
invertedColors?: HexColor[]
lang?: string
layout?: PositionProps
shadow?: ShadowProps
/**
* @default false
*/
showLabel?: boolean
showLeaderLines?: boolean
/**
* @default false
*/
showLegend?: boolean
/**
* @default false
*/
showPercent?: boolean
/**
* @default false
*/
showSerName?: boolean
/**
* @default false
*/
showTitle?: boolean
/**
* @default false
*/
showValue?: boolean
/**
* 3D Perspecitve
* - range: 0-120
* @default 30
*/
v3DPerspective?: number
/**
* Right Angle Axes
* - Shows chart from first-person perspective
* - Overrides `v3DPerspective` when true
* - PowerPoint: Chart Options > 3-D Rotation
* @default false
*/
v3DRAngAx?: boolean
/**
* X Rotation
* - PowerPoint: Chart Options > 3-D Rotation
* - range: 0-359.9
* @default 30
*/
v3DRotX?: number
/**
* Y Rotation
* - range: 0-359.9
* @default 30
*/
v3DRotY?: number
/**
* PowerPoint: Format Chart Area (Fill & Border/Line)
* @since v3.11
*/
chartArea?: IChartAreaProps
/**
* PowerPoint: Format Plot Area (Fill & Border/Line)
* @since v3.11
*/
plotArea?: IChartPropsFillLine
/**
* @deprecated v3.11.0 - use `plotArea.border`
*/
border?: BorderProps
/**
* @deprecated v3.11.0 - use `plotArea.fill`
*/
fill?: HexColor
}
export interface IChartPropsAxisCat {
/**
* Multi-Chart prop: array of cat axes
*/
catAxes?: IChartPropsAxisCat[]
catAxisBaseTimeUnit?: string
catAxisCrossesAt?: number | 'autoZero'
catAxisHidden?: boolean
catAxisLabelColor?: string
catAxisLabelFontBold?: boolean
catAxisLabelFontFace?: string
catAxisLabelFontItalic?: boolean
catAxisLabelFontSize?: number
catAxisLabelFrequency?: string
catAxisLabelPos?: 'none' | 'low' | 'high' | 'nextTo'
catAxisLabelRotate?: number
catAxisLineColor?: string
catAxisLineShow?: boolean
catAxisLineSize?: number
catAxisLineStyle?: 'solid' | 'dash' | 'dot'
catAxisMajorTickMark?: ChartAxisTickMark
catAxisMajorTimeUnit?: string
catAxisMajorUnit?: number
catAxisMaxVal?: number
catAxisMinorTickMark?: ChartAxisTickMark
catAxisMinorTimeUnit?: string
catAxisMinorUnit?: number
catAxisMinVal?: number
/** @since v3.11.0 */
catAxisMultiLevelLabels?: boolean
catAxisOrientation?: 'minMax'
catAxisTitle?: string
catAxisTitleColor?: string
catAxisTitleFontFace?: string
catAxisTitleFontSize?: number
catAxisTitleRotate?: number
catGridLine?: OptsChartGridLine
catLabelFormatCode?: string
/**
* Whether data should use secondary category axis (instead of primary)
* @default false
*/
secondaryCatAxis?: boolean
showCatAxisTitle?: boolean
}
export interface IChartPropsAxisSer {
serAxisBaseTimeUnit?: string
serAxisHidden?: boolean
serAxisLabelColor?: string
serAxisLabelFontBold?: boolean
serAxisLabelFontFace?: string
serAxisLabelFontItalic?: boolean
serAxisLabelFontSize?: number
serAxisLabelFrequency?: string
serAxisLabelPos?: 'none' | 'low' | 'high' | 'nextTo'
serAxisLineColor?: string
serAxisLineShow?: boolean
serAxisMajorTimeUnit?: string
serAxisMajorUnit?: number
serAxisMinorTimeUnit?: string
serAxisMinorUnit?: number
serAxisOrientation?: string
serAxisTitle?: string
serAxisTitleColor?: string
serAxisTitleFontFace?: string
serAxisTitleFontSize?: number
serAxisTitleRotate?: number
serGridLine?: OptsChartGridLine
serLabelFormatCode?: string
showSerAxisTitle?: boolean
}
export interface IChartPropsAxisVal {
/**
* Whether data should use secondary value axis (instead of primary)
* @default false
*/
secondaryValAxis?: boolean
showValAxisTitle?: boolean
/**
* Multi-Chart prop: array of val axes
*/
valAxes?: IChartPropsAxisVal[]
valAxisCrossesAt?: number | 'autoZero'
valAxisDisplayUnit?: 'billions' | 'hundredMillions' | 'hundreds' | 'hundredThousands' | 'millions' | 'tenMillions' | 'tenThousands' | 'thousands' | 'trillions'
valAxisDisplayUnitLabel?: boolean
valAxisHidden?: boolean
valAxisLabelColor?: string
valAxisLabelFontBold?: boolean
valAxisLabelFontFace?: string
valAxisLabelFontItalic?: boolean
valAxisLabelFontSize?: number
valAxisLabelFormatCode?: string
valAxisLabelPos?: 'none' | 'low' | 'high' | 'nextTo'
valAxisLabelRotate?: number
valAxisLineColor?: string
valAxisLineShow?: boolean
valAxisLineSize?: number
valAxisLineStyle?: 'solid' | 'dash' | 'dot'
/**
* PowerPoint: Format Axis > Axis Options > Logarithmic scale - Base
* - range: 2-99
* @since v3.5.0
*/
valAxisLogScaleBase?: number
valAxisMajorTickMark?: ChartAxisTickMark
valAxisMajorUnit?: number
valAxisMaxVal?: number
valAxisMinorTickMark?: ChartAxisTickMark
valAxisMinVal?: number
valAxisOrientation?: 'minMax'
valAxisTitle?: string
valAxisTitleColor?: string
valAxisTitleFontFace?: string
valAxisTitleFontSize?: number
valAxisTitleRotate?: number
valGridLine?: OptsChartGridLine
/**
* Value label format code
* - this also directs Data Table formatting
* @since v3.3.0
* @example '#%' // round percent
* @example '0.00%' // shows values as '0.00%'
* @example '$0.00' // shows values as '$0.00'
*/
valLabelFormatCode?: string
}
export interface IChartPropsChartBar {
bar3DShape?: string
barDir?: string
barGapDepthPct?: number
/**
* MS-PPT > Format chart > Format Data Point > Series Options > "Gap Width"
* - width (percent)
* - range: `0`-`500`
* @default 150
*/
barGapWidthPct?: number
barGrouping?: string
/**
* MS-PPT > Format chart > Format Data Point > Series Options > "Series Overlap"
* - overlap (percent)
* - range: `-100`-`100`
* @since v3.9.0
* @default 0
*/
barOverlapPct?: number
}
export interface IChartPropsChartDoughnut {
dataNoEffects?: boolean
holeSize?: number
}
export interface IChartPropsChartLine {
/**
* MS-PPT > Chart format > Format Data Series > Line > Cap type
* - line cap type
* @default flat
*/
lineCap?: ChartLineCap
/**
* MS-PPT > Chart format > Format Data Series > Marker Options > Built-in > Type
* - line dash type
* @default solid
*/
lineDash?: 'dash' | 'dashDot' | 'lgDash' | 'lgDashDot' | 'lgDashDotDot' | 'solid' | 'sysDash' | 'sysDot'
/**
* MS-PPT > Chart format > Format Data Series > Marker Options > Built-in > Type
* - marker type
* @default circle
*/
lineDataSymbol?: 'circle' | 'dash' | 'diamond' | 'dot' | 'none' | 'square' | 'triangle'
/**
* MS-PPT > Chart format > Format Data Series > [Marker Options] > Border > Color
* - border color
* @default circle
*/
lineDataSymbolLineColor?: string
/**
* MS-PPT > Chart format > Format Data Series > [Marker Options] > Border > Width
* - border width (points)
* @default 0.75
*/
lineDataSymbolLineSize?: number
/**
* MS-PPT > Chart format > Format Data Series > Marker Options > Built-in > Size
* - marker size
* - range: 2-72
* @default 6
*/
lineDataSymbolSize?: number
/**
* MS-PPT > Chart format > Format Data Series > Line > Width
* - line width (points)
* - range: 0-1584
* @default 2
*/
lineSize?: number
/**
* MS-PPT > Chart format > Format Data Series > Line > Smoothed line
* - "Smoothed line"
* @default false
*/
lineSmooth?: boolean
}
export interface IChartPropsChartPie {
dataNoEffects?: boolean
/**
* MS-PPT > Format chart > Format Data Series > Series Options > "Angle of first slice"
* - angle (degrees)
* - range: 0-359
* @since v3.4.0
* @default 0
*/
firstSliceAng?: number
}
export interface IChartPropsChartRadar {
/**
* MS-PPT > Chart Type > Waterfall
* - radar chart type
* @default standard
*/
radarStyle?: 'standard' | 'marker' | 'filled' // TODO: convert to 'radar'|'markers'|'filled' in 4.0 (verbatim with PPT app UI)
}
export interface IChartPropsDataLabel {
dataLabelBkgrdColors?: boolean
dataLabelColor?: string
dataLabelFontBold?: boolean
dataLabelFontFace?: string
dataLabelFontItalic?: boolean
dataLabelFontSize?: number
/**
* Data label format code
* @example '#%' // round percent
* @example '0.00%' // shows values as '0.00%'
* @example '$0.00' // shows values as '$0.00'
*/
dataLabelFormatCode?: string
dataLabelFormatScatter?: 'custom' | 'customXY' | 'XY'
dataLabelPosition?: 'b' | 'bestFit' | 'ctr' | 'l' | 'r' | 't' | 'inEnd' | 'outEnd'
}
export interface IChartPropsDataTable {
dataTableFontSize?: number
/**
* Data table format code
* @since v3.3.0
* @example '#%' // round percent
* @example '0.00%' // shows values as '0.00%'
* @example '$0.00' // shows values as '$0.00'
*/
dataTableFormatCode?: string
/**
* Whether to show a data table adjacent to the chart
* @default false
*/
showDataTable?: boolean
showDataTableHorzBorder?: boolean
showDataTableKeys?: boolean
showDataTableOutline?: boolean
showDataTableVertBorder?: boolean
}
export interface IChartPropsLegend {
legendColor?: string
legendFontFace?: string
legendFontSize?: number
legendPos?: 'b' | 'l' | 'r' | 't' | 'tr'
}
export interface IChartPropsTitle extends TextBaseProps {
title?: string
titleAlign?: string
titleBold?: boolean
titleColor?: string
titleFontFace?: string
titleFontSize?: number
titlePos?: { x: number, y: number }
titleRotate?: number
}
export interface IChartOpts
extends IChartPropsAxisCat,
IChartPropsAxisSer,
IChartPropsAxisVal,
IChartPropsBase,
IChartPropsChartBar,
IChartPropsChartDoughnut,
IChartPropsChartLine,
IChartPropsChartPie,
IChartPropsChartRadar,
IChartPropsDataLabel,
IChartPropsDataTable,
IChartPropsLegend,
IChartPropsTitle,
ObjectNameProps,
OptsChartGridLine,
PositionProps {
/**
* Alt Text value ("How would you describe this object and its contents to someone who is blind?")
* - PowerPoint: [right-click on a chart] > "Edit Alt Text..."
*/
altText?: string
}
export interface IChartOptsLib extends IChartOpts {
_type?: CHART_NAME | IChartMulti[] // TODO: v3.4.0 - move to `IChartOpts`, remove `IChartOptsLib`
}
export interface ISlideRelChart extends OptsChartData {
type: CHART_NAME | IChartMulti[]
opts: IChartOptsLib
data: IOptsChartData[]
// internal below
rId: number
Target: string
globalId: number
fileName: string
}
// Core
// ====
// PRIVATE vvv
export interface ISlideRel {
type: SLIDE_OBJECT_TYPES
Target: string
fileName?: string
data: any[] | string
opts?: IChartOpts
path?: string
extn?: string
globalId?: number
rId: number
}
export interface ISlideRelMedia {
type: string
opts?: MediaProps
path?: string
extn?: string
data?: string | ArrayBuffer
/** used to indicate that a media file has already been read/enocded (PERF) */
isDuplicate?: boolean
isSvgPng?: boolean
svgSize?: { w: number, h: number }
rId: number
Target: string
}
export interface ISlideObject {
_type: SLIDE_OBJECT_TYPES
options?: ObjectOptions
// text
text?: TextProps[]
// table
arrTabRows?: TableCell[][]
// chart
chartRid?: number
// image:
image?: string
imageRid?: number
hyperlink?: HyperlinkProps
// media
media?: string
mtype?: MediaType
mediaRid?: number
shape?: SHAPE_NAME
formula?: string
formulaAlign?: 'left' | 'center' | 'right'
}
// PRIVATE ^^^
export interface WriteBaseProps {
/**
* Whether to compress export (can save substantial space, but takes a bit longer to export)
* @default false
* @since v3.5.0
*/
compression?: boolean
}
export interface WriteProps extends WriteBaseProps {
/**
* Output type
* - values: 'arraybuffer' | 'base64' | 'binarystring' | 'blob' | 'nodebuffer' | 'uint8array' | 'STREAM'
* @default 'blob'
*/
outputType?: WRITE_OUTPUT_TYPE
}
export interface WriteFileProps extends WriteBaseProps {
/**
* Export file name
* @default 'Presentation.pptx'
*/
fileName?: string
}
export interface SectionProps {
_type: 'user' | 'default'
_slides: PresSlide[]
/**
* Section title
*/
title: string
/**
* Section order - uses to add section at any index
* - values: 1-n
*/
order?: number
}
export interface PresLayout {
_sizeW?: number
_sizeH?: number
/**
* Layout Name
* @example 'LAYOUT_WIDE'
*/
name: string
width: number
height: number
}
export interface SlideNumberProps extends PositionProps, TextBaseProps {
/**
* margin (points)
*/
margin?: Margin // TODO: convert to inches in 4.0 (valid values are 0-22)
}
export interface SlideMasterProps {
/**
* Unique name for this master
*/
title: string
background?: BackgroundProps
margin?: Margin
slideNumber?: SlideNumberProps
objects?: Array< | { chart: IChartOpts }
| { image: ImageProps }
| { line: ShapeProps }
| { rect: ShapeProps }
| { text: TextProps }
| {
placeholder: {
options: PlaceholderProps
/**
* Text to be shown in placeholder (shown until user focuses textbox or adds text)
* - Leave blank to have powerpoint show default phrase (ex: "Click to add title")
*/
text?: string
}
}>
/**
* @deprecated v3.3.0 - use `background`
*/
bkgd?: string | BackgroundProps
}
export interface ObjectOptions extends ImageProps, PositionProps, ShapeProps, TableCellProps, TextPropsOptions {
_placeholderIdx?: number
_placeholderType?: PLACEHOLDER_TYPE
cx?: Coord
cy?: Coord
margin?: Margin
colW?: number | number[] // table
rowH?: number | number[] // table
}
export interface SlideBaseProps {
_bkgdImgRid?: number
_margin?: Margin
_name?: string
_presLayout: PresLayout
_rels: ISlideRel[]
_relsChart: ISlideRelChart[] // needed as we use args:"PresSlide|SlideLayout" often
_relsMedia: ISlideRelMedia[] // needed as we use args:"PresSlide|SlideLayout" often
_slideNum: number
_slideNumberProps?: SlideNumberProps
_slideObjects?: ISlideObject[]
background?: BackgroundProps
/**
* @deprecated v3.3.0 - use `background`
*/
bkgd?: string | BackgroundProps
}
export interface SlideLayout extends SlideBaseProps {
_slide?: {
_bkgdImgRid?: number
back: string
color: string
hidden?: boolean
}
}
export interface PresSlide extends SlideBaseProps {
_rId: number
_slideLayout: SlideLayout
_slideId: number
addChart: (type: CHART_NAME | IChartMulti[], data: IOptsChartData[], options?: IChartOpts) => PresSlide
addImage: (options: ImageProps) => PresSlide
addMedia: (options: MediaProps) => PresSlide
addNotes: (notes: string) => PresSlide
addShape: (shapeName: SHAPE_NAME, options?: ShapeProps) => PresSlide
addTable: (tableRows: TableRow[], options?: TableProps) => PresSlide
addText: (text: string | TextProps[], options?: TextPropsOptions) => PresSlide
/**
* Background color or image (`color` | `path` | `data`)
* @example { color: 'FF3399' } - hex color
* @example { color: 'FF3399', transparency:50 } - hex color with 50% transparency
* @example { path: 'https://onedrives.com/myimg.png` } - retrieve image via URL
* @example { path: '/home/gitbrent/images/myimg.png` } - retrieve image via local path
* @example { data: 'image/png;base64,iVtDaDrF[...]=' } - base64 string
* @since v3.3.0
*/
background?: BackgroundProps
/**
* Default text color (hex format)
* @example 'FF3399'
* @default '000000' (DEF_FONT_COLOR)
*/
color?: HexColor
/**
* Whether slide is hidden
* @default false
*/
hidden?: boolean
/**
* Slide number options
*/
slideNumber?: SlideNumberProps
}
export interface AddSlideProps {
masterName?: string // TODO: 20200528: rename to "masterTitle" (createMaster uses `title` so lets be consistent)
sectionTitle?: string
}
export interface PresentationProps {
author: string
company: string
layout: string
masterSlide: PresSlide
/**
* Presentation's layout
* read-only
*/
presLayout: PresLayout
revision: string
/**
* Whether to enable right-to-left mode
* @default false
*/
rtlMode: boolean
subject: string
theme: ThemeProps
title: string
}
// PRIVATE interface
export interface IPresentationProps extends PresentationProps {
sections: SectionProps[]
slideLayouts: SlideLayout[]
slides: PresSlide[]
}
|