See Release Notes
Long Term Support Release
Differences Between: [Versions 39 and 311] [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 and 403]
1 <?php 2 3 namespace PhpOffice\PhpSpreadsheet\Writer\Xlsx; 4 5 use PhpOffice\PhpSpreadsheet\Shared\XMLWriter; 6 use PhpOffice\PhpSpreadsheet\Spreadsheet; 7 8 /** 9 * @category PhpSpreadsheet 10 * 11 * @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet) 12 */ 13 class Theme extends WriterPart 14 { 15 /** 16 * Map of Major fonts to write. 17 * 18 * @var array of string 19 */ 20 private static $majorFonts = [ 21 'Jpan' => 'MS Pゴシック', 22 'Hang' => '맑은 고딕', 23 'Hans' => '宋体', 24 'Hant' => '新細明體', 25 'Arab' => 'Times New Roman', 26 'Hebr' => 'Times New Roman', 27 'Thai' => 'Tahoma', 28 'Ethi' => 'Nyala', 29 'Beng' => 'Vrinda', 30 'Gujr' => 'Shruti', 31 'Khmr' => 'MoolBoran', 32 'Knda' => 'Tunga', 33 'Guru' => 'Raavi', 34 'Cans' => 'Euphemia', 35 'Cher' => 'Plantagenet Cherokee', 36 'Yiii' => 'Microsoft Yi Baiti', 37 'Tibt' => 'Microsoft Himalaya', 38 'Thaa' => 'MV Boli', 39 'Deva' => 'Mangal', 40 'Telu' => 'Gautami', 41 'Taml' => 'Latha', 42 'Syrc' => 'Estrangelo Edessa', 43 'Orya' => 'Kalinga', 44 'Mlym' => 'Kartika', 45 'Laoo' => 'DokChampa', 46 'Sinh' => 'Iskoola Pota', 47 'Mong' => 'Mongolian Baiti', 48 'Viet' => 'Times New Roman', 49 'Uigh' => 'Microsoft Uighur', 50 'Geor' => 'Sylfaen', 51 ]; 52 53 /** 54 * Map of Minor fonts to write. 55 * 56 * @var array of string 57 */ 58 private static $minorFonts = [ 59 'Jpan' => 'MS Pゴシック', 60 'Hang' => '맑은 고딕', 61 'Hans' => '宋体', 62 'Hant' => '新細明體', 63 'Arab' => 'Arial', 64 'Hebr' => 'Arial', 65 'Thai' => 'Tahoma', 66 'Ethi' => 'Nyala', 67 'Beng' => 'Vrinda', 68 'Gujr' => 'Shruti', 69 'Khmr' => 'DaunPenh', 70 'Knda' => 'Tunga', 71 'Guru' => 'Raavi', 72 'Cans' => 'Euphemia', 73 'Cher' => 'Plantagenet Cherokee', 74 'Yiii' => 'Microsoft Yi Baiti', 75 'Tibt' => 'Microsoft Himalaya', 76 'Thaa' => 'MV Boli', 77 'Deva' => 'Mangal', 78 'Telu' => 'Gautami', 79 'Taml' => 'Latha', 80 'Syrc' => 'Estrangelo Edessa', 81 'Orya' => 'Kalinga', 82 'Mlym' => 'Kartika', 83 'Laoo' => 'DokChampa', 84 'Sinh' => 'Iskoola Pota', 85 'Mong' => 'Mongolian Baiti', 86 'Viet' => 'Arial', 87 'Uigh' => 'Microsoft Uighur', 88 'Geor' => 'Sylfaen', 89 ]; 90 91 /** 92 * Map of core colours. 93 * 94 * @var array of string 95 */ 96 private static $colourScheme = [ 97 'dk2' => '1F497D', 98 'lt2' => 'EEECE1', 99 'accent1' => '4F81BD', 100 'accent2' => 'C0504D', 101 'accent3' => '9BBB59', 102 'accent4' => '8064A2', 103 'accent5' => '4BACC6', 104 'accent6' => 'F79646', 105 'hlink' => '0000FF', 106 'folHlink' => '800080', 107 ]; 108 109 /** 110 * Write theme to XML format. 111 * 112 * @param Spreadsheet $spreadsheet 113 * 114 * @throws \PhpOffice\PhpSpreadsheet\Writer\Exception 115 * 116 * @return string XML Output 117 */ 118 public function writeTheme(Spreadsheet $spreadsheet) 119 { 120 // Create XML writer 121 $objWriter = null; 122 if ($this->getParentWriter()->getUseDiskCaching()) { 123 $objWriter = new XMLWriter(XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory()); 124 } else { 125 $objWriter = new XMLWriter(XMLWriter::STORAGE_MEMORY); 126 } 127 128 // XML header 129 $objWriter->startDocument('1.0', 'UTF-8', 'yes'); 130 131 // a:theme 132 $objWriter->startElement('a:theme'); 133 $objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main'); 134 $objWriter->writeAttribute('name', 'Office Theme'); 135 136 // a:themeElements 137 $objWriter->startElement('a:themeElements'); 138 139 // a:clrScheme 140 $objWriter->startElement('a:clrScheme'); 141 $objWriter->writeAttribute('name', 'Office'); 142 143 // a:dk1 144 $objWriter->startElement('a:dk1'); 145 146 // a:sysClr 147 $objWriter->startElement('a:sysClr'); 148 $objWriter->writeAttribute('val', 'windowText'); 149 $objWriter->writeAttribute('lastClr', '000000'); 150 $objWriter->endElement(); 151 152 $objWriter->endElement(); 153 154 // a:lt1 155 $objWriter->startElement('a:lt1'); 156 157 // a:sysClr 158 $objWriter->startElement('a:sysClr'); 159 $objWriter->writeAttribute('val', 'window'); 160 $objWriter->writeAttribute('lastClr', 'FFFFFF'); 161 $objWriter->endElement(); 162 163 $objWriter->endElement(); 164 165 // a:dk2 166 $this->writeColourScheme($objWriter); 167 168 $objWriter->endElement(); 169 170 // a:fontScheme 171 $objWriter->startElement('a:fontScheme'); 172 $objWriter->writeAttribute('name', 'Office'); 173 174 // a:majorFont 175 $objWriter->startElement('a:majorFont'); 176 $this->writeFonts($objWriter, 'Cambria', self::$majorFonts); 177 $objWriter->endElement(); 178 179 // a:minorFont 180 $objWriter->startElement('a:minorFont'); 181 $this->writeFonts($objWriter, 'Calibri', self::$minorFonts); 182 $objWriter->endElement(); 183 184 $objWriter->endElement(); 185 186 // a:fmtScheme 187 $objWriter->startElement('a:fmtScheme'); 188 $objWriter->writeAttribute('name', 'Office'); 189 190 // a:fillStyleLst 191 $objWriter->startElement('a:fillStyleLst'); 192 193 // a:solidFill 194 $objWriter->startElement('a:solidFill'); 195 196 // a:schemeClr 197 $objWriter->startElement('a:schemeClr'); 198 $objWriter->writeAttribute('val', 'phClr'); 199 $objWriter->endElement(); 200 201 $objWriter->endElement(); 202 203 // a:gradFill 204 $objWriter->startElement('a:gradFill'); 205 $objWriter->writeAttribute('rotWithShape', '1'); 206 207 // a:gsLst 208 $objWriter->startElement('a:gsLst'); 209 210 // a:gs 211 $objWriter->startElement('a:gs'); 212 $objWriter->writeAttribute('pos', '0'); 213 214 // a:schemeClr 215 $objWriter->startElement('a:schemeClr'); 216 $objWriter->writeAttribute('val', 'phClr'); 217 218 // a:tint 219 $objWriter->startElement('a:tint'); 220 $objWriter->writeAttribute('val', '50000'); 221 $objWriter->endElement(); 222 223 // a:satMod 224 $objWriter->startElement('a:satMod'); 225 $objWriter->writeAttribute('val', '300000'); 226 $objWriter->endElement(); 227 228 $objWriter->endElement(); 229 230 $objWriter->endElement(); 231 232 // a:gs 233 $objWriter->startElement('a:gs'); 234 $objWriter->writeAttribute('pos', '35000'); 235 236 // a:schemeClr 237 $objWriter->startElement('a:schemeClr'); 238 $objWriter->writeAttribute('val', 'phClr'); 239 240 // a:tint 241 $objWriter->startElement('a:tint'); 242 $objWriter->writeAttribute('val', '37000'); 243 $objWriter->endElement(); 244 245 // a:satMod 246 $objWriter->startElement('a:satMod'); 247 $objWriter->writeAttribute('val', '300000'); 248 $objWriter->endElement(); 249 250 $objWriter->endElement(); 251 252 $objWriter->endElement(); 253 254 // a:gs 255 $objWriter->startElement('a:gs'); 256 $objWriter->writeAttribute('pos', '100000'); 257 258 // a:schemeClr 259 $objWriter->startElement('a:schemeClr'); 260 $objWriter->writeAttribute('val', 'phClr'); 261 262 // a:tint 263 $objWriter->startElement('a:tint'); 264 $objWriter->writeAttribute('val', '15000'); 265 $objWriter->endElement(); 266 267 // a:satMod 268 $objWriter->startElement('a:satMod'); 269 $objWriter->writeAttribute('val', '350000'); 270 $objWriter->endElement(); 271 272 $objWriter->endElement(); 273 274 $objWriter->endElement(); 275 276 $objWriter->endElement(); 277 278 // a:lin 279 $objWriter->startElement('a:lin'); 280 $objWriter->writeAttribute('ang', '16200000'); 281 $objWriter->writeAttribute('scaled', '1'); 282 $objWriter->endElement(); 283 284 $objWriter->endElement(); 285 286 // a:gradFill 287 $objWriter->startElement('a:gradFill'); 288 $objWriter->writeAttribute('rotWithShape', '1'); 289 290 // a:gsLst 291 $objWriter->startElement('a:gsLst'); 292 293 // a:gs 294 $objWriter->startElement('a:gs'); 295 $objWriter->writeAttribute('pos', '0'); 296 297 // a:schemeClr 298 $objWriter->startElement('a:schemeClr'); 299 $objWriter->writeAttribute('val', 'phClr'); 300 301 // a:shade 302 $objWriter->startElement('a:shade'); 303 $objWriter->writeAttribute('val', '51000'); 304 $objWriter->endElement(); 305 306 // a:satMod 307 $objWriter->startElement('a:satMod'); 308 $objWriter->writeAttribute('val', '130000'); 309 $objWriter->endElement(); 310 311 $objWriter->endElement(); 312 313 $objWriter->endElement(); 314 315 // a:gs 316 $objWriter->startElement('a:gs'); 317 $objWriter->writeAttribute('pos', '80000'); 318 319 // a:schemeClr 320 $objWriter->startElement('a:schemeClr'); 321 $objWriter->writeAttribute('val', 'phClr'); 322 323 // a:shade 324 $objWriter->startElement('a:shade'); 325 $objWriter->writeAttribute('val', '93000'); 326 $objWriter->endElement(); 327 328 // a:satMod 329 $objWriter->startElement('a:satMod'); 330 $objWriter->writeAttribute('val', '130000'); 331 $objWriter->endElement(); 332 333 $objWriter->endElement(); 334 335 $objWriter->endElement(); 336 337 // a:gs 338 $objWriter->startElement('a:gs'); 339 $objWriter->writeAttribute('pos', '100000'); 340 341 // a:schemeClr 342 $objWriter->startElement('a:schemeClr'); 343 $objWriter->writeAttribute('val', 'phClr'); 344 345 // a:shade 346 $objWriter->startElement('a:shade'); 347 $objWriter->writeAttribute('val', '94000'); 348 $objWriter->endElement(); 349 350 // a:satMod 351 $objWriter->startElement('a:satMod'); 352 $objWriter->writeAttribute('val', '135000'); 353 $objWriter->endElement(); 354 355 $objWriter->endElement(); 356 357 $objWriter->endElement(); 358 359 $objWriter->endElement(); 360 361 // a:lin 362 $objWriter->startElement('a:lin'); 363 $objWriter->writeAttribute('ang', '16200000'); 364 $objWriter->writeAttribute('scaled', '0'); 365 $objWriter->endElement(); 366 367 $objWriter->endElement(); 368 369 $objWriter->endElement(); 370 371 // a:lnStyleLst 372 $objWriter->startElement('a:lnStyleLst'); 373 374 // a:ln 375 $objWriter->startElement('a:ln'); 376 $objWriter->writeAttribute('w', '9525'); 377 $objWriter->writeAttribute('cap', 'flat'); 378 $objWriter->writeAttribute('cmpd', 'sng'); 379 $objWriter->writeAttribute('algn', 'ctr'); 380 381 // a:solidFill 382 $objWriter->startElement('a:solidFill'); 383 384 // a:schemeClr 385 $objWriter->startElement('a:schemeClr'); 386 $objWriter->writeAttribute('val', 'phClr'); 387 388 // a:shade 389 $objWriter->startElement('a:shade'); 390 $objWriter->writeAttribute('val', '95000'); 391 $objWriter->endElement(); 392 393 // a:satMod 394 $objWriter->startElement('a:satMod'); 395 $objWriter->writeAttribute('val', '105000'); 396 $objWriter->endElement(); 397 398 $objWriter->endElement(); 399 400 $objWriter->endElement(); 401 402 // a:prstDash 403 $objWriter->startElement('a:prstDash'); 404 $objWriter->writeAttribute('val', 'solid'); 405 $objWriter->endElement(); 406 407 $objWriter->endElement(); 408 409 // a:ln 410 $objWriter->startElement('a:ln'); 411 $objWriter->writeAttribute('w', '25400'); 412 $objWriter->writeAttribute('cap', 'flat'); 413 $objWriter->writeAttribute('cmpd', 'sng'); 414 $objWriter->writeAttribute('algn', 'ctr'); 415 416 // a:solidFill 417 $objWriter->startElement('a:solidFill'); 418 419 // a:schemeClr 420 $objWriter->startElement('a:schemeClr'); 421 $objWriter->writeAttribute('val', 'phClr'); 422 $objWriter->endElement(); 423 424 $objWriter->endElement(); 425 426 // a:prstDash 427 $objWriter->startElement('a:prstDash'); 428 $objWriter->writeAttribute('val', 'solid'); 429 $objWriter->endElement(); 430 431 $objWriter->endElement(); 432 433 // a:ln 434 $objWriter->startElement('a:ln'); 435 $objWriter->writeAttribute('w', '38100'); 436 $objWriter->writeAttribute('cap', 'flat'); 437 $objWriter->writeAttribute('cmpd', 'sng'); 438 $objWriter->writeAttribute('algn', 'ctr'); 439 440 // a:solidFill 441 $objWriter->startElement('a:solidFill'); 442 443 // a:schemeClr 444 $objWriter->startElement('a:schemeClr'); 445 $objWriter->writeAttribute('val', 'phClr'); 446 $objWriter->endElement(); 447 448 $objWriter->endElement(); 449 450 // a:prstDash 451 $objWriter->startElement('a:prstDash'); 452 $objWriter->writeAttribute('val', 'solid'); 453 $objWriter->endElement(); 454 455 $objWriter->endElement(); 456 457 $objWriter->endElement(); 458 459 // a:effectStyleLst 460 $objWriter->startElement('a:effectStyleLst'); 461 462 // a:effectStyle 463 $objWriter->startElement('a:effectStyle'); 464 465 // a:effectLst 466 $objWriter->startElement('a:effectLst'); 467 468 // a:outerShdw 469 $objWriter->startElement('a:outerShdw'); 470 $objWriter->writeAttribute('blurRad', '40000'); 471 $objWriter->writeAttribute('dist', '20000'); 472 $objWriter->writeAttribute('dir', '5400000'); 473 $objWriter->writeAttribute('rotWithShape', '0'); 474 475 // a:srgbClr 476 $objWriter->startElement('a:srgbClr'); 477 $objWriter->writeAttribute('val', '000000'); 478 479 // a:alpha 480 $objWriter->startElement('a:alpha'); 481 $objWriter->writeAttribute('val', '38000'); 482 $objWriter->endElement(); 483 484 $objWriter->endElement(); 485 486 $objWriter->endElement(); 487 488 $objWriter->endElement(); 489 490 $objWriter->endElement(); 491 492 // a:effectStyle 493 $objWriter->startElement('a:effectStyle'); 494 495 // a:effectLst 496 $objWriter->startElement('a:effectLst'); 497 498 // a:outerShdw 499 $objWriter->startElement('a:outerShdw'); 500 $objWriter->writeAttribute('blurRad', '40000'); 501 $objWriter->writeAttribute('dist', '23000'); 502 $objWriter->writeAttribute('dir', '5400000'); 503 $objWriter->writeAttribute('rotWithShape', '0'); 504 505 // a:srgbClr 506 $objWriter->startElement('a:srgbClr'); 507 $objWriter->writeAttribute('val', '000000'); 508 509 // a:alpha 510 $objWriter->startElement('a:alpha'); 511 $objWriter->writeAttribute('val', '35000'); 512 $objWriter->endElement(); 513 514 $objWriter->endElement(); 515 516 $objWriter->endElement(); 517 518 $objWriter->endElement(); 519 520 $objWriter->endElement(); 521 522 // a:effectStyle 523 $objWriter->startElement('a:effectStyle'); 524 525 // a:effectLst 526 $objWriter->startElement('a:effectLst'); 527 528 // a:outerShdw 529 $objWriter->startElement('a:outerShdw'); 530 $objWriter->writeAttribute('blurRad', '40000'); 531 $objWriter->writeAttribute('dist', '23000'); 532 $objWriter->writeAttribute('dir', '5400000'); 533 $objWriter->writeAttribute('rotWithShape', '0'); 534 535 // a:srgbClr 536 $objWriter->startElement('a:srgbClr'); 537 $objWriter->writeAttribute('val', '000000'); 538 539 // a:alpha 540 $objWriter->startElement('a:alpha'); 541 $objWriter->writeAttribute('val', '35000'); 542 $objWriter->endElement(); 543 544 $objWriter->endElement(); 545 546 $objWriter->endElement(); 547 548 $objWriter->endElement(); 549 550 // a:scene3d 551 $objWriter->startElement('a:scene3d'); 552 553 // a:camera 554 $objWriter->startElement('a:camera'); 555 $objWriter->writeAttribute('prst', 'orthographicFront'); 556 557 // a:rot 558 $objWriter->startElement('a:rot'); 559 $objWriter->writeAttribute('lat', '0'); 560 $objWriter->writeAttribute('lon', '0'); 561 $objWriter->writeAttribute('rev', '0'); 562 $objWriter->endElement(); 563 564 $objWriter->endElement(); 565 566 // a:lightRig 567 $objWriter->startElement('a:lightRig'); 568 $objWriter->writeAttribute('rig', 'threePt'); 569 $objWriter->writeAttribute('dir', 't'); 570 571 // a:rot 572 $objWriter->startElement('a:rot'); 573 $objWriter->writeAttribute('lat', '0'); 574 $objWriter->writeAttribute('lon', '0'); 575 $objWriter->writeAttribute('rev', '1200000'); 576 $objWriter->endElement(); 577 578 $objWriter->endElement(); 579 580 $objWriter->endElement(); 581 582 // a:sp3d 583 $objWriter->startElement('a:sp3d'); 584 585 // a:bevelT 586 $objWriter->startElement('a:bevelT'); 587 $objWriter->writeAttribute('w', '63500'); 588 $objWriter->writeAttribute('h', '25400'); 589 $objWriter->endElement(); 590 591 $objWriter->endElement(); 592 593 $objWriter->endElement(); 594 595 $objWriter->endElement(); 596 597 // a:bgFillStyleLst 598 $objWriter->startElement('a:bgFillStyleLst'); 599 600 // a:solidFill 601 $objWriter->startElement('a:solidFill'); 602 603 // a:schemeClr 604 $objWriter->startElement('a:schemeClr'); 605 $objWriter->writeAttribute('val', 'phClr'); 606 $objWriter->endElement(); 607 608 $objWriter->endElement(); 609 610 // a:gradFill 611 $objWriter->startElement('a:gradFill'); 612 $objWriter->writeAttribute('rotWithShape', '1'); 613 614 // a:gsLst 615 $objWriter->startElement('a:gsLst'); 616 617 // a:gs 618 $objWriter->startElement('a:gs'); 619 $objWriter->writeAttribute('pos', '0'); 620 621 // a:schemeClr 622 $objWriter->startElement('a:schemeClr'); 623 $objWriter->writeAttribute('val', 'phClr'); 624 625 // a:tint 626 $objWriter->startElement('a:tint'); 627 $objWriter->writeAttribute('val', '40000'); 628 $objWriter->endElement(); 629 630 // a:satMod 631 $objWriter->startElement('a:satMod'); 632 $objWriter->writeAttribute('val', '350000'); 633 $objWriter->endElement(); 634 635 $objWriter->endElement(); 636 637 $objWriter->endElement(); 638 639 // a:gs 640 $objWriter->startElement('a:gs'); 641 $objWriter->writeAttribute('pos', '40000'); 642 643 // a:schemeClr 644 $objWriter->startElement('a:schemeClr'); 645 $objWriter->writeAttribute('val', 'phClr'); 646 647 // a:tint 648 $objWriter->startElement('a:tint'); 649 $objWriter->writeAttribute('val', '45000'); 650 $objWriter->endElement(); 651 652 // a:shade 653 $objWriter->startElement('a:shade'); 654 $objWriter->writeAttribute('val', '99000'); 655 $objWriter->endElement(); 656 657 // a:satMod 658 $objWriter->startElement('a:satMod'); 659 $objWriter->writeAttribute('val', '350000'); 660 $objWriter->endElement(); 661 662 $objWriter->endElement(); 663 664 $objWriter->endElement(); 665 666 // a:gs 667 $objWriter->startElement('a:gs'); 668 $objWriter->writeAttribute('pos', '100000'); 669 670 // a:schemeClr 671 $objWriter->startElement('a:schemeClr'); 672 $objWriter->writeAttribute('val', 'phClr'); 673 674 // a:shade 675 $objWriter->startElement('a:shade'); 676 $objWriter->writeAttribute('val', '20000'); 677 $objWriter->endElement(); 678 679 // a:satMod 680 $objWriter->startElement('a:satMod'); 681 $objWriter->writeAttribute('val', '255000'); 682 $objWriter->endElement(); 683 684 $objWriter->endElement(); 685 686 $objWriter->endElement(); 687 688 $objWriter->endElement(); 689 690 // a:path 691 $objWriter->startElement('a:path'); 692 $objWriter->writeAttribute('path', 'circle'); 693 694 // a:fillToRect 695 $objWriter->startElement('a:fillToRect'); 696 $objWriter->writeAttribute('l', '50000'); 697 $objWriter->writeAttribute('t', '-80000'); 698 $objWriter->writeAttribute('r', '50000'); 699 $objWriter->writeAttribute('b', '180000'); 700 $objWriter->endElement(); 701 702 $objWriter->endElement(); 703 704 $objWriter->endElement(); 705 706 // a:gradFill 707 $objWriter->startElement('a:gradFill'); 708 $objWriter->writeAttribute('rotWithShape', '1'); 709 710 // a:gsLst 711 $objWriter->startElement('a:gsLst'); 712 713 // a:gs 714 $objWriter->startElement('a:gs'); 715 $objWriter->writeAttribute('pos', '0'); 716 717 // a:schemeClr 718 $objWriter->startElement('a:schemeClr'); 719 $objWriter->writeAttribute('val', 'phClr'); 720 721 // a:tint 722 $objWriter->startElement('a:tint'); 723 $objWriter->writeAttribute('val', '80000'); 724 $objWriter->endElement(); 725 726 // a:satMod 727 $objWriter->startElement('a:satMod'); 728 $objWriter->writeAttribute('val', '300000'); 729 $objWriter->endElement(); 730 731 $objWriter->endElement(); 732 733 $objWriter->endElement(); 734 735 // a:gs 736 $objWriter->startElement('a:gs'); 737 $objWriter->writeAttribute('pos', '100000'); 738 739 // a:schemeClr 740 $objWriter->startElement('a:schemeClr'); 741 $objWriter->writeAttribute('val', 'phClr'); 742 743 // a:shade 744 $objWriter->startElement('a:shade'); 745 $objWriter->writeAttribute('val', '30000'); 746 $objWriter->endElement(); 747 748 // a:satMod 749 $objWriter->startElement('a:satMod'); 750 $objWriter->writeAttribute('val', '200000'); 751 $objWriter->endElement(); 752 753 $objWriter->endElement(); 754 755 $objWriter->endElement(); 756 757 $objWriter->endElement(); 758 759 // a:path 760 $objWriter->startElement('a:path'); 761 $objWriter->writeAttribute('path', 'circle'); 762 763 // a:fillToRect 764 $objWriter->startElement('a:fillToRect'); 765 $objWriter->writeAttribute('l', '50000'); 766 $objWriter->writeAttribute('t', '50000'); 767 $objWriter->writeAttribute('r', '50000'); 768 $objWriter->writeAttribute('b', '50000'); 769 $objWriter->endElement(); 770 771 $objWriter->endElement(); 772 773 $objWriter->endElement(); 774 775 $objWriter->endElement(); 776 777 $objWriter->endElement(); 778 779 $objWriter->endElement(); 780 781 // a:objectDefaults 782 $objWriter->writeElement('a:objectDefaults', null); 783 784 // a:extraClrSchemeLst 785 $objWriter->writeElement('a:extraClrSchemeLst', null); 786 787 $objWriter->endElement(); 788 789 // Return 790 return $objWriter->getData(); 791 } 792 793 /** 794 * Write fonts to XML format. 795 * 796 * @param XMLWriter $objWriter 797 * @param string $latinFont 798 * @param array of string $fontSet 799 * 800 * @return string XML Output 801 */ 802 private function writeFonts($objWriter, $latinFont, $fontSet) 803 { 804 // a:latin 805 $objWriter->startElement('a:latin'); 806 $objWriter->writeAttribute('typeface', $latinFont); 807 $objWriter->endElement(); 808 809 // a:ea 810 $objWriter->startElement('a:ea'); 811 $objWriter->writeAttribute('typeface', ''); 812 $objWriter->endElement(); 813 814 // a:cs 815 $objWriter->startElement('a:cs'); 816 $objWriter->writeAttribute('typeface', ''); 817 $objWriter->endElement(); 818 819 foreach ($fontSet as $fontScript => $typeface) { 820 $objWriter->startElement('a:font'); 821 $objWriter->writeAttribute('script', $fontScript); 822 $objWriter->writeAttribute('typeface', $typeface); 823 $objWriter->endElement(); 824 } 825 } 826 827 /** 828 * Write colour scheme to XML format. 829 * 830 * @param XMLWriter $objWriter 831 * 832 * @return string XML Output 833 */ 834 private function writeColourScheme($objWriter) 835 { 836 foreach (self::$colourScheme as $colourName => $colourValue) { 837 $objWriter->startElement('a:' . $colourName); 838 839 $objWriter->startElement('a:srgbClr'); 840 $objWriter->writeAttribute('val', $colourValue); 841 $objWriter->endElement(); 842 843 $objWriter->endElement(); 844 } 845 } 846 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body