Theme.php 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869
  1. <?php
  2. /**
  3. * PHPExcel
  4. *
  5. * Copyright (c) 2006 - 2015 PHPExcel
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Lesser General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2.1 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Lesser General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Lesser General Public
  18. * License along with this library; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  20. *
  21. * @category PHPExcel
  22. * @package PHPExcel_Writer_Excel2007
  23. * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
  24. * @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
  25. * @version ##VERSION##, ##DATE##
  26. */
  27. /**
  28. * PHPExcel_Writer_Excel2007_Theme
  29. *
  30. * @category PHPExcel
  31. * @package PHPExcel_Writer_Excel2007
  32. * @copyright Copyright (c) 2006 - 2015 PHPExcel (http://www.codeplex.com/PHPExcel)
  33. */
  34. class PHPExcel_Writer_Excel2007_Theme extends PHPExcel_Writer_Excel2007_WriterPart
  35. {
  36. /**
  37. * Map of Major fonts to write
  38. * @static array of string
  39. *
  40. */
  41. private static $majorFonts = array(
  42. 'Jpan' => 'MS Pゴシック',
  43. 'Hang' => '맑은 고딕',
  44. 'Hans' => '宋体',
  45. 'Hant' => '新細明體',
  46. 'Arab' => 'Times New Roman',
  47. 'Hebr' => 'Times New Roman',
  48. 'Thai' => 'Tahoma',
  49. 'Ethi' => 'Nyala',
  50. 'Beng' => 'Vrinda',
  51. 'Gujr' => 'Shruti',
  52. 'Khmr' => 'MoolBoran',
  53. 'Knda' => 'Tunga',
  54. 'Guru' => 'Raavi',
  55. 'Cans' => 'Euphemia',
  56. 'Cher' => 'Plantagenet Cherokee',
  57. 'Yiii' => 'Microsoft Yi Baiti',
  58. 'Tibt' => 'Microsoft Himalaya',
  59. 'Thaa' => 'MV Boli',
  60. 'Deva' => 'Mangal',
  61. 'Telu' => 'Gautami',
  62. 'Taml' => 'Latha',
  63. 'Syrc' => 'Estrangelo Edessa',
  64. 'Orya' => 'Kalinga',
  65. 'Mlym' => 'Kartika',
  66. 'Laoo' => 'DokChampa',
  67. 'Sinh' => 'Iskoola Pota',
  68. 'Mong' => 'Mongolian Baiti',
  69. 'Viet' => 'Times New Roman',
  70. 'Uigh' => 'Microsoft Uighur',
  71. 'Geor' => 'Sylfaen',
  72. );
  73. /**
  74. * Map of Minor fonts to write
  75. * @static array of string
  76. *
  77. */
  78. private static $minorFonts = array(
  79. 'Jpan' => 'MS Pゴシック',
  80. 'Hang' => '맑은 고딕',
  81. 'Hans' => '宋体',
  82. 'Hant' => '新細明體',
  83. 'Arab' => 'Arial',
  84. 'Hebr' => 'Arial',
  85. 'Thai' => 'Tahoma',
  86. 'Ethi' => 'Nyala',
  87. 'Beng' => 'Vrinda',
  88. 'Gujr' => 'Shruti',
  89. 'Khmr' => 'DaunPenh',
  90. 'Knda' => 'Tunga',
  91. 'Guru' => 'Raavi',
  92. 'Cans' => 'Euphemia',
  93. 'Cher' => 'Plantagenet Cherokee',
  94. 'Yiii' => 'Microsoft Yi Baiti',
  95. 'Tibt' => 'Microsoft Himalaya',
  96. 'Thaa' => 'MV Boli',
  97. 'Deva' => 'Mangal',
  98. 'Telu' => 'Gautami',
  99. 'Taml' => 'Latha',
  100. 'Syrc' => 'Estrangelo Edessa',
  101. 'Orya' => 'Kalinga',
  102. 'Mlym' => 'Kartika',
  103. 'Laoo' => 'DokChampa',
  104. 'Sinh' => 'Iskoola Pota',
  105. 'Mong' => 'Mongolian Baiti',
  106. 'Viet' => 'Arial',
  107. 'Uigh' => 'Microsoft Uighur',
  108. 'Geor' => 'Sylfaen',
  109. );
  110. /**
  111. * Map of core colours
  112. * @static array of string
  113. *
  114. */
  115. private static $colourScheme = array(
  116. 'dk2' => '1F497D',
  117. 'lt2' => 'EEECE1',
  118. 'accent1' => '4F81BD',
  119. 'accent2' => 'C0504D',
  120. 'accent3' => '9BBB59',
  121. 'accent4' => '8064A2',
  122. 'accent5' => '4BACC6',
  123. 'accent6' => 'F79646',
  124. 'hlink' => '0000FF',
  125. 'folHlink' => '800080',
  126. );
  127. /**
  128. * Write theme to XML format
  129. *
  130. * @param PHPExcel $pPHPExcel
  131. * @return string XML Output
  132. * @throws PHPExcel_Writer_Exception
  133. */
  134. public function writeTheme(PHPExcel $pPHPExcel = null)
  135. {
  136. // Create XML writer
  137. $objWriter = null;
  138. if ($this->getParentWriter()->getUseDiskCaching()) {
  139. $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_DISK, $this->getParentWriter()->getDiskCachingDirectory());
  140. } else {
  141. $objWriter = new PHPExcel_Shared_XMLWriter(PHPExcel_Shared_XMLWriter::STORAGE_MEMORY);
  142. }
  143. // XML header
  144. $objWriter->startDocument('1.0', 'UTF-8', 'yes');
  145. // a:theme
  146. $objWriter->startElement('a:theme');
  147. $objWriter->writeAttribute('xmlns:a', 'http://schemas.openxmlformats.org/drawingml/2006/main');
  148. $objWriter->writeAttribute('name', 'Office Theme');
  149. // a:themeElements
  150. $objWriter->startElement('a:themeElements');
  151. // a:clrScheme
  152. $objWriter->startElement('a:clrScheme');
  153. $objWriter->writeAttribute('name', 'Office');
  154. // a:dk1
  155. $objWriter->startElement('a:dk1');
  156. // a:sysClr
  157. $objWriter->startElement('a:sysClr');
  158. $objWriter->writeAttribute('val', 'windowText');
  159. $objWriter->writeAttribute('lastClr', '000000');
  160. $objWriter->endElement();
  161. $objWriter->endElement();
  162. // a:lt1
  163. $objWriter->startElement('a:lt1');
  164. // a:sysClr
  165. $objWriter->startElement('a:sysClr');
  166. $objWriter->writeAttribute('val', 'window');
  167. $objWriter->writeAttribute('lastClr', 'FFFFFF');
  168. $objWriter->endElement();
  169. $objWriter->endElement();
  170. // a:dk2
  171. $this->writeColourScheme($objWriter);
  172. $objWriter->endElement();
  173. // a:fontScheme
  174. $objWriter->startElement('a:fontScheme');
  175. $objWriter->writeAttribute('name', 'Office');
  176. // a:majorFont
  177. $objWriter->startElement('a:majorFont');
  178. $this->writeFonts($objWriter, 'Cambria', self::$majorFonts);
  179. $objWriter->endElement();
  180. // a:minorFont
  181. $objWriter->startElement('a:minorFont');
  182. $this->writeFonts($objWriter, 'Calibri', self::$minorFonts);
  183. $objWriter->endElement();
  184. $objWriter->endElement();
  185. // a:fmtScheme
  186. $objWriter->startElement('a:fmtScheme');
  187. $objWriter->writeAttribute('name', 'Office');
  188. // a:fillStyleLst
  189. $objWriter->startElement('a:fillStyleLst');
  190. // a:solidFill
  191. $objWriter->startElement('a:solidFill');
  192. // a:schemeClr
  193. $objWriter->startElement('a:schemeClr');
  194. $objWriter->writeAttribute('val', 'phClr');
  195. $objWriter->endElement();
  196. $objWriter->endElement();
  197. // a:gradFill
  198. $objWriter->startElement('a:gradFill');
  199. $objWriter->writeAttribute('rotWithShape', '1');
  200. // a:gsLst
  201. $objWriter->startElement('a:gsLst');
  202. // a:gs
  203. $objWriter->startElement('a:gs');
  204. $objWriter->writeAttribute('pos', '0');
  205. // a:schemeClr
  206. $objWriter->startElement('a:schemeClr');
  207. $objWriter->writeAttribute('val', 'phClr');
  208. // a:tint
  209. $objWriter->startElement('a:tint');
  210. $objWriter->writeAttribute('val', '50000');
  211. $objWriter->endElement();
  212. // a:satMod
  213. $objWriter->startElement('a:satMod');
  214. $objWriter->writeAttribute('val', '300000');
  215. $objWriter->endElement();
  216. $objWriter->endElement();
  217. $objWriter->endElement();
  218. // a:gs
  219. $objWriter->startElement('a:gs');
  220. $objWriter->writeAttribute('pos', '35000');
  221. // a:schemeClr
  222. $objWriter->startElement('a:schemeClr');
  223. $objWriter->writeAttribute('val', 'phClr');
  224. // a:tint
  225. $objWriter->startElement('a:tint');
  226. $objWriter->writeAttribute('val', '37000');
  227. $objWriter->endElement();
  228. // a:satMod
  229. $objWriter->startElement('a:satMod');
  230. $objWriter->writeAttribute('val', '300000');
  231. $objWriter->endElement();
  232. $objWriter->endElement();
  233. $objWriter->endElement();
  234. // a:gs
  235. $objWriter->startElement('a:gs');
  236. $objWriter->writeAttribute('pos', '100000');
  237. // a:schemeClr
  238. $objWriter->startElement('a:schemeClr');
  239. $objWriter->writeAttribute('val', 'phClr');
  240. // a:tint
  241. $objWriter->startElement('a:tint');
  242. $objWriter->writeAttribute('val', '15000');
  243. $objWriter->endElement();
  244. // a:satMod
  245. $objWriter->startElement('a:satMod');
  246. $objWriter->writeAttribute('val', '350000');
  247. $objWriter->endElement();
  248. $objWriter->endElement();
  249. $objWriter->endElement();
  250. $objWriter->endElement();
  251. // a:lin
  252. $objWriter->startElement('a:lin');
  253. $objWriter->writeAttribute('ang', '16200000');
  254. $objWriter->writeAttribute('scaled', '1');
  255. $objWriter->endElement();
  256. $objWriter->endElement();
  257. // a:gradFill
  258. $objWriter->startElement('a:gradFill');
  259. $objWriter->writeAttribute('rotWithShape', '1');
  260. // a:gsLst
  261. $objWriter->startElement('a:gsLst');
  262. // a:gs
  263. $objWriter->startElement('a:gs');
  264. $objWriter->writeAttribute('pos', '0');
  265. // a:schemeClr
  266. $objWriter->startElement('a:schemeClr');
  267. $objWriter->writeAttribute('val', 'phClr');
  268. // a:shade
  269. $objWriter->startElement('a:shade');
  270. $objWriter->writeAttribute('val', '51000');
  271. $objWriter->endElement();
  272. // a:satMod
  273. $objWriter->startElement('a:satMod');
  274. $objWriter->writeAttribute('val', '130000');
  275. $objWriter->endElement();
  276. $objWriter->endElement();
  277. $objWriter->endElement();
  278. // a:gs
  279. $objWriter->startElement('a:gs');
  280. $objWriter->writeAttribute('pos', '80000');
  281. // a:schemeClr
  282. $objWriter->startElement('a:schemeClr');
  283. $objWriter->writeAttribute('val', 'phClr');
  284. // a:shade
  285. $objWriter->startElement('a:shade');
  286. $objWriter->writeAttribute('val', '93000');
  287. $objWriter->endElement();
  288. // a:satMod
  289. $objWriter->startElement('a:satMod');
  290. $objWriter->writeAttribute('val', '130000');
  291. $objWriter->endElement();
  292. $objWriter->endElement();
  293. $objWriter->endElement();
  294. // a:gs
  295. $objWriter->startElement('a:gs');
  296. $objWriter->writeAttribute('pos', '100000');
  297. // a:schemeClr
  298. $objWriter->startElement('a:schemeClr');
  299. $objWriter->writeAttribute('val', 'phClr');
  300. // a:shade
  301. $objWriter->startElement('a:shade');
  302. $objWriter->writeAttribute('val', '94000');
  303. $objWriter->endElement();
  304. // a:satMod
  305. $objWriter->startElement('a:satMod');
  306. $objWriter->writeAttribute('val', '135000');
  307. $objWriter->endElement();
  308. $objWriter->endElement();
  309. $objWriter->endElement();
  310. $objWriter->endElement();
  311. // a:lin
  312. $objWriter->startElement('a:lin');
  313. $objWriter->writeAttribute('ang', '16200000');
  314. $objWriter->writeAttribute('scaled', '0');
  315. $objWriter->endElement();
  316. $objWriter->endElement();
  317. $objWriter->endElement();
  318. // a:lnStyleLst
  319. $objWriter->startElement('a:lnStyleLst');
  320. // a:ln
  321. $objWriter->startElement('a:ln');
  322. $objWriter->writeAttribute('w', '9525');
  323. $objWriter->writeAttribute('cap', 'flat');
  324. $objWriter->writeAttribute('cmpd', 'sng');
  325. $objWriter->writeAttribute('algn', 'ctr');
  326. // a:solidFill
  327. $objWriter->startElement('a:solidFill');
  328. // a:schemeClr
  329. $objWriter->startElement('a:schemeClr');
  330. $objWriter->writeAttribute('val', 'phClr');
  331. // a:shade
  332. $objWriter->startElement('a:shade');
  333. $objWriter->writeAttribute('val', '95000');
  334. $objWriter->endElement();
  335. // a:satMod
  336. $objWriter->startElement('a:satMod');
  337. $objWriter->writeAttribute('val', '105000');
  338. $objWriter->endElement();
  339. $objWriter->endElement();
  340. $objWriter->endElement();
  341. // a:prstDash
  342. $objWriter->startElement('a:prstDash');
  343. $objWriter->writeAttribute('val', 'solid');
  344. $objWriter->endElement();
  345. $objWriter->endElement();
  346. // a:ln
  347. $objWriter->startElement('a:ln');
  348. $objWriter->writeAttribute('w', '25400');
  349. $objWriter->writeAttribute('cap', 'flat');
  350. $objWriter->writeAttribute('cmpd', 'sng');
  351. $objWriter->writeAttribute('algn', 'ctr');
  352. // a:solidFill
  353. $objWriter->startElement('a:solidFill');
  354. // a:schemeClr
  355. $objWriter->startElement('a:schemeClr');
  356. $objWriter->writeAttribute('val', 'phClr');
  357. $objWriter->endElement();
  358. $objWriter->endElement();
  359. // a:prstDash
  360. $objWriter->startElement('a:prstDash');
  361. $objWriter->writeAttribute('val', 'solid');
  362. $objWriter->endElement();
  363. $objWriter->endElement();
  364. // a:ln
  365. $objWriter->startElement('a:ln');
  366. $objWriter->writeAttribute('w', '38100');
  367. $objWriter->writeAttribute('cap', 'flat');
  368. $objWriter->writeAttribute('cmpd', 'sng');
  369. $objWriter->writeAttribute('algn', 'ctr');
  370. // a:solidFill
  371. $objWriter->startElement('a:solidFill');
  372. // a:schemeClr
  373. $objWriter->startElement('a:schemeClr');
  374. $objWriter->writeAttribute('val', 'phClr');
  375. $objWriter->endElement();
  376. $objWriter->endElement();
  377. // a:prstDash
  378. $objWriter->startElement('a:prstDash');
  379. $objWriter->writeAttribute('val', 'solid');
  380. $objWriter->endElement();
  381. $objWriter->endElement();
  382. $objWriter->endElement();
  383. // a:effectStyleLst
  384. $objWriter->startElement('a:effectStyleLst');
  385. // a:effectStyle
  386. $objWriter->startElement('a:effectStyle');
  387. // a:effectLst
  388. $objWriter->startElement('a:effectLst');
  389. // a:outerShdw
  390. $objWriter->startElement('a:outerShdw');
  391. $objWriter->writeAttribute('blurRad', '40000');
  392. $objWriter->writeAttribute('dist', '20000');
  393. $objWriter->writeAttribute('dir', '5400000');
  394. $objWriter->writeAttribute('rotWithShape', '0');
  395. // a:srgbClr
  396. $objWriter->startElement('a:srgbClr');
  397. $objWriter->writeAttribute('val', '000000');
  398. // a:alpha
  399. $objWriter->startElement('a:alpha');
  400. $objWriter->writeAttribute('val', '38000');
  401. $objWriter->endElement();
  402. $objWriter->endElement();
  403. $objWriter->endElement();
  404. $objWriter->endElement();
  405. $objWriter->endElement();
  406. // a:effectStyle
  407. $objWriter->startElement('a:effectStyle');
  408. // a:effectLst
  409. $objWriter->startElement('a:effectLst');
  410. // a:outerShdw
  411. $objWriter->startElement('a:outerShdw');
  412. $objWriter->writeAttribute('blurRad', '40000');
  413. $objWriter->writeAttribute('dist', '23000');
  414. $objWriter->writeAttribute('dir', '5400000');
  415. $objWriter->writeAttribute('rotWithShape', '0');
  416. // a:srgbClr
  417. $objWriter->startElement('a:srgbClr');
  418. $objWriter->writeAttribute('val', '000000');
  419. // a:alpha
  420. $objWriter->startElement('a:alpha');
  421. $objWriter->writeAttribute('val', '35000');
  422. $objWriter->endElement();
  423. $objWriter->endElement();
  424. $objWriter->endElement();
  425. $objWriter->endElement();
  426. $objWriter->endElement();
  427. // a:effectStyle
  428. $objWriter->startElement('a:effectStyle');
  429. // a:effectLst
  430. $objWriter->startElement('a:effectLst');
  431. // a:outerShdw
  432. $objWriter->startElement('a:outerShdw');
  433. $objWriter->writeAttribute('blurRad', '40000');
  434. $objWriter->writeAttribute('dist', '23000');
  435. $objWriter->writeAttribute('dir', '5400000');
  436. $objWriter->writeAttribute('rotWithShape', '0');
  437. // a:srgbClr
  438. $objWriter->startElement('a:srgbClr');
  439. $objWriter->writeAttribute('val', '000000');
  440. // a:alpha
  441. $objWriter->startElement('a:alpha');
  442. $objWriter->writeAttribute('val', '35000');
  443. $objWriter->endElement();
  444. $objWriter->endElement();
  445. $objWriter->endElement();
  446. $objWriter->endElement();
  447. // a:scene3d
  448. $objWriter->startElement('a:scene3d');
  449. // a:camera
  450. $objWriter->startElement('a:camera');
  451. $objWriter->writeAttribute('prst', 'orthographicFront');
  452. // a:rot
  453. $objWriter->startElement('a:rot');
  454. $objWriter->writeAttribute('lat', '0');
  455. $objWriter->writeAttribute('lon', '0');
  456. $objWriter->writeAttribute('rev', '0');
  457. $objWriter->endElement();
  458. $objWriter->endElement();
  459. // a:lightRig
  460. $objWriter->startElement('a:lightRig');
  461. $objWriter->writeAttribute('rig', 'threePt');
  462. $objWriter->writeAttribute('dir', 't');
  463. // a:rot
  464. $objWriter->startElement('a:rot');
  465. $objWriter->writeAttribute('lat', '0');
  466. $objWriter->writeAttribute('lon', '0');
  467. $objWriter->writeAttribute('rev', '1200000');
  468. $objWriter->endElement();
  469. $objWriter->endElement();
  470. $objWriter->endElement();
  471. // a:sp3d
  472. $objWriter->startElement('a:sp3d');
  473. // a:bevelT
  474. $objWriter->startElement('a:bevelT');
  475. $objWriter->writeAttribute('w', '63500');
  476. $objWriter->writeAttribute('h', '25400');
  477. $objWriter->endElement();
  478. $objWriter->endElement();
  479. $objWriter->endElement();
  480. $objWriter->endElement();
  481. // a:bgFillStyleLst
  482. $objWriter->startElement('a:bgFillStyleLst');
  483. // a:solidFill
  484. $objWriter->startElement('a:solidFill');
  485. // a:schemeClr
  486. $objWriter->startElement('a:schemeClr');
  487. $objWriter->writeAttribute('val', 'phClr');
  488. $objWriter->endElement();
  489. $objWriter->endElement();
  490. // a:gradFill
  491. $objWriter->startElement('a:gradFill');
  492. $objWriter->writeAttribute('rotWithShape', '1');
  493. // a:gsLst
  494. $objWriter->startElement('a:gsLst');
  495. // a:gs
  496. $objWriter->startElement('a:gs');
  497. $objWriter->writeAttribute('pos', '0');
  498. // a:schemeClr
  499. $objWriter->startElement('a:schemeClr');
  500. $objWriter->writeAttribute('val', 'phClr');
  501. // a:tint
  502. $objWriter->startElement('a:tint');
  503. $objWriter->writeAttribute('val', '40000');
  504. $objWriter->endElement();
  505. // a:satMod
  506. $objWriter->startElement('a:satMod');
  507. $objWriter->writeAttribute('val', '350000');
  508. $objWriter->endElement();
  509. $objWriter->endElement();
  510. $objWriter->endElement();
  511. // a:gs
  512. $objWriter->startElement('a:gs');
  513. $objWriter->writeAttribute('pos', '40000');
  514. // a:schemeClr
  515. $objWriter->startElement('a:schemeClr');
  516. $objWriter->writeAttribute('val', 'phClr');
  517. // a:tint
  518. $objWriter->startElement('a:tint');
  519. $objWriter->writeAttribute('val', '45000');
  520. $objWriter->endElement();
  521. // a:shade
  522. $objWriter->startElement('a:shade');
  523. $objWriter->writeAttribute('val', '99000');
  524. $objWriter->endElement();
  525. // a:satMod
  526. $objWriter->startElement('a:satMod');
  527. $objWriter->writeAttribute('val', '350000');
  528. $objWriter->endElement();
  529. $objWriter->endElement();
  530. $objWriter->endElement();
  531. // a:gs
  532. $objWriter->startElement('a:gs');
  533. $objWriter->writeAttribute('pos', '100000');
  534. // a:schemeClr
  535. $objWriter->startElement('a:schemeClr');
  536. $objWriter->writeAttribute('val', 'phClr');
  537. // a:shade
  538. $objWriter->startElement('a:shade');
  539. $objWriter->writeAttribute('val', '20000');
  540. $objWriter->endElement();
  541. // a:satMod
  542. $objWriter->startElement('a:satMod');
  543. $objWriter->writeAttribute('val', '255000');
  544. $objWriter->endElement();
  545. $objWriter->endElement();
  546. $objWriter->endElement();
  547. $objWriter->endElement();
  548. // a:path
  549. $objWriter->startElement('a:path');
  550. $objWriter->writeAttribute('path', 'circle');
  551. // a:fillToRect
  552. $objWriter->startElement('a:fillToRect');
  553. $objWriter->writeAttribute('l', '50000');
  554. $objWriter->writeAttribute('t', '-80000');
  555. $objWriter->writeAttribute('r', '50000');
  556. $objWriter->writeAttribute('b', '180000');
  557. $objWriter->endElement();
  558. $objWriter->endElement();
  559. $objWriter->endElement();
  560. // a:gradFill
  561. $objWriter->startElement('a:gradFill');
  562. $objWriter->writeAttribute('rotWithShape', '1');
  563. // a:gsLst
  564. $objWriter->startElement('a:gsLst');
  565. // a:gs
  566. $objWriter->startElement('a:gs');
  567. $objWriter->writeAttribute('pos', '0');
  568. // a:schemeClr
  569. $objWriter->startElement('a:schemeClr');
  570. $objWriter->writeAttribute('val', 'phClr');
  571. // a:tint
  572. $objWriter->startElement('a:tint');
  573. $objWriter->writeAttribute('val', '80000');
  574. $objWriter->endElement();
  575. // a:satMod
  576. $objWriter->startElement('a:satMod');
  577. $objWriter->writeAttribute('val', '300000');
  578. $objWriter->endElement();
  579. $objWriter->endElement();
  580. $objWriter->endElement();
  581. // a:gs
  582. $objWriter->startElement('a:gs');
  583. $objWriter->writeAttribute('pos', '100000');
  584. // a:schemeClr
  585. $objWriter->startElement('a:schemeClr');
  586. $objWriter->writeAttribute('val', 'phClr');
  587. // a:shade
  588. $objWriter->startElement('a:shade');
  589. $objWriter->writeAttribute('val', '30000');
  590. $objWriter->endElement();
  591. // a:satMod
  592. $objWriter->startElement('a:satMod');
  593. $objWriter->writeAttribute('val', '200000');
  594. $objWriter->endElement();
  595. $objWriter->endElement();
  596. $objWriter->endElement();
  597. $objWriter->endElement();
  598. // a:path
  599. $objWriter->startElement('a:path');
  600. $objWriter->writeAttribute('path', 'circle');
  601. // a:fillToRect
  602. $objWriter->startElement('a:fillToRect');
  603. $objWriter->writeAttribute('l', '50000');
  604. $objWriter->writeAttribute('t', '50000');
  605. $objWriter->writeAttribute('r', '50000');
  606. $objWriter->writeAttribute('b', '50000');
  607. $objWriter->endElement();
  608. $objWriter->endElement();
  609. $objWriter->endElement();
  610. $objWriter->endElement();
  611. $objWriter->endElement();
  612. $objWriter->endElement();
  613. // a:objectDefaults
  614. $objWriter->writeElement('a:objectDefaults', null);
  615. // a:extraClrSchemeLst
  616. $objWriter->writeElement('a:extraClrSchemeLst', null);
  617. $objWriter->endElement();
  618. // Return
  619. return $objWriter->getData();
  620. }
  621. /**
  622. * Write fonts to XML format
  623. *
  624. * @param PHPExcel_Shared_XMLWriter $objWriter
  625. * @param string $latinFont
  626. * @param array of string $fontSet
  627. * @return string XML Output
  628. * @throws PHPExcel_Writer_Exception
  629. */
  630. private function writeFonts($objWriter, $latinFont, $fontSet)
  631. {
  632. // a:latin
  633. $objWriter->startElement('a:latin');
  634. $objWriter->writeAttribute('typeface', $latinFont);
  635. $objWriter->endElement();
  636. // a:ea
  637. $objWriter->startElement('a:ea');
  638. $objWriter->writeAttribute('typeface', '');
  639. $objWriter->endElement();
  640. // a:cs
  641. $objWriter->startElement('a:cs');
  642. $objWriter->writeAttribute('typeface', '');
  643. $objWriter->endElement();
  644. foreach ($fontSet as $fontScript => $typeface) {
  645. $objWriter->startElement('a:font');
  646. $objWriter->writeAttribute('script', $fontScript);
  647. $objWriter->writeAttribute('typeface', $typeface);
  648. $objWriter->endElement();
  649. }
  650. }
  651. /**
  652. * Write colour scheme to XML format
  653. *
  654. * @param PHPExcel_Shared_XMLWriter $objWriter
  655. * @return string XML Output
  656. * @throws PHPExcel_Writer_Exception
  657. */
  658. private function writeColourScheme($objWriter)
  659. {
  660. foreach (self::$colourScheme as $colourName => $colourValue) {
  661. $objWriter->startElement('a:'.$colourName);
  662. $objWriter->startElement('a:srgbClr');
  663. $objWriter->writeAttribute('val', $colourValue);
  664. $objWriter->endElement();
  665. $objWriter->endElement();
  666. }
  667. }
  668. }