Ei kuvausta

excel.php 23KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  1. <?php
  2. return array(
  3. 'cache' => [
  4. /*
  5. |--------------------------------------------------------------------------
  6. | Enable/Disable cell caching
  7. |--------------------------------------------------------------------------
  8. */
  9. 'enable' => true,
  10. /*
  11. |--------------------------------------------------------------------------
  12. | Caching driver
  13. |--------------------------------------------------------------------------
  14. |
  15. | Set the caching driver
  16. |
  17. | Available methods:
  18. | memory|gzip|serialized|igbinary|discISAM|apc|memcache|temp|wincache|sqlite|sqlite3
  19. |
  20. */
  21. 'driver' => 'memory',
  22. /*
  23. |--------------------------------------------------------------------------
  24. | Cache settings
  25. |--------------------------------------------------------------------------
  26. */
  27. 'settings' => [
  28. 'memoryCacheSize' => '32MB',
  29. 'cacheTime' => 600
  30. ],
  31. /*
  32. |--------------------------------------------------------------------------
  33. | Memcache settings
  34. |--------------------------------------------------------------------------
  35. */
  36. 'memcache' => [
  37. 'host' => 'localhost',
  38. 'port' => 11211,
  39. ],
  40. /*
  41. |--------------------------------------------------------------------------
  42. | Cache dir (for discISAM)
  43. |--------------------------------------------------------------------------
  44. */
  45. 'dir' => storage_path('cache')
  46. ],
  47. 'properties' => [
  48. 'creator' => 'Maatwebsite',
  49. 'lastModifiedBy' => 'Maatwebsite',
  50. 'title' => 'Spreadsheet',
  51. 'description' => 'Default spreadsheet export',
  52. 'subject' => 'Spreadsheet export',
  53. 'keywords' => 'maatwebsite, excel, export',
  54. 'category' => 'Excel',
  55. 'manager' => 'Maatwebsite',
  56. 'company' => 'Maatwebsite',
  57. ],
  58. /*
  59. |--------------------------------------------------------------------------
  60. | Sheets settings
  61. |--------------------------------------------------------------------------
  62. */
  63. 'sheets' => [
  64. /*
  65. |--------------------------------------------------------------------------
  66. | Default page setup
  67. |--------------------------------------------------------------------------
  68. */
  69. 'pageSetup' => [
  70. 'orientation' => 'portrait',
  71. 'paperSize' => '9',
  72. 'scale' => '100',
  73. 'fitToPage' => false,
  74. 'fitToHeight' => true,
  75. 'fitToWidth' => true,
  76. 'columnsToRepeatAtLeft' => ['', ''],
  77. 'rowsToRepeatAtTop' => [0, 0],
  78. 'horizontalCentered' => false,
  79. 'verticalCentered' => false,
  80. 'printArea' => null,
  81. 'firstPageNumber' => null,
  82. ],
  83. ],
  84. /*
  85. |--------------------------------------------------------------------------
  86. | Creator
  87. |--------------------------------------------------------------------------
  88. |
  89. | The default creator of a new Excel file
  90. |
  91. */
  92. 'creator' => 'Maatwebsite',
  93. 'csv' => [
  94. /*
  95. |--------------------------------------------------------------------------
  96. | Delimiter
  97. |--------------------------------------------------------------------------
  98. |
  99. | The default delimiter which will be used to read out a CSV file
  100. |
  101. */
  102. 'delimiter' => ',',
  103. /*
  104. |--------------------------------------------------------------------------
  105. | Enclosure
  106. |--------------------------------------------------------------------------
  107. */
  108. 'enclosure' => '"',
  109. /*
  110. |--------------------------------------------------------------------------
  111. | Line endings
  112. |--------------------------------------------------------------------------
  113. */
  114. 'line_ending' => "\r\n",
  115. /*
  116. |--------------------------------------------------------------------------
  117. | setUseBom
  118. |--------------------------------------------------------------------------
  119. */
  120. 'use_bom' => false
  121. ],
  122. 'export' => [
  123. /*
  124. |--------------------------------------------------------------------------
  125. | Autosize columns
  126. |--------------------------------------------------------------------------
  127. |
  128. | Disable/enable column autosize or set the autosizing for
  129. | an array of columns ( array('A', 'B') )
  130. |
  131. */
  132. 'autosize' => true,
  133. /*
  134. |--------------------------------------------------------------------------
  135. | Autosize method
  136. |--------------------------------------------------------------------------
  137. |
  138. | --> PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX
  139. | The default is based on an estimate, which does its calculation based
  140. | on the number of characters in the cell value (applying any calculation
  141. | and format mask, and allowing for wordwrap and rotation) and with an
  142. | "arbitrary" adjustment based on the font (Arial, Calibri or Verdana,
  143. | defaulting to Calibri if any other font is used) and a proportional
  144. | adjustment for the font size.
  145. |
  146. | --> PHPExcel_Shared_Font::AUTOSIZE_METHOD_EXACT
  147. | The second method is more accurate, based on actual style formatting as
  148. | well (bold, italic, etc), and is calculated by generating a gd2 imagettf
  149. | bounding box and using its dimensions to determine the size; but this
  150. | method is significantly slower, and its accuracy is still dependent on
  151. | having the appropriate fonts installed.
  152. |
  153. */
  154. 'autosize-method' => PHPExcel_Shared_Font::AUTOSIZE_METHOD_APPROX,
  155. /*
  156. |--------------------------------------------------------------------------
  157. | Auto generate table heading
  158. |--------------------------------------------------------------------------
  159. |
  160. | If set to true, the array indices (or model attribute names)
  161. | will automatically be used as first row (table heading)
  162. |
  163. */
  164. 'generate_heading_by_indices' => true,
  165. /*
  166. |--------------------------------------------------------------------------
  167. | Auto set alignment on merged cells
  168. |--------------------------------------------------------------------------
  169. */
  170. 'merged_cell_alignment' => 'left',
  171. /*
  172. |--------------------------------------------------------------------------
  173. | Pre-calculate formulas during export
  174. |--------------------------------------------------------------------------
  175. */
  176. 'calculate' => false,
  177. /*
  178. |--------------------------------------------------------------------------
  179. | Include Charts during export
  180. |--------------------------------------------------------------------------
  181. */
  182. 'includeCharts' => false,
  183. /*
  184. |--------------------------------------------------------------------------
  185. | Default sheet settings
  186. |--------------------------------------------------------------------------
  187. */
  188. 'sheets' => [
  189. /*
  190. |--------------------------------------------------------------------------
  191. | Default page margin
  192. |--------------------------------------------------------------------------
  193. |
  194. | 1) When set to false, default margins will be used
  195. | 2) It's possible to enter a single margin which will
  196. | be used for all margins.
  197. | 3) Alternatively you can pass an array with 4 margins
  198. | Default order: array(top, right, bottom, left)
  199. |
  200. */
  201. 'page_margin' => false,
  202. /*
  203. |--------------------------------------------------------------------------
  204. | Value in source array that stands for blank cell
  205. |--------------------------------------------------------------------------
  206. */
  207. 'nullValue' => null,
  208. /*
  209. |--------------------------------------------------------------------------
  210. | Insert array starting from this cell address as the top left coordinate
  211. |--------------------------------------------------------------------------
  212. */
  213. 'startCell' => 'A1',
  214. /*
  215. |--------------------------------------------------------------------------
  216. | Apply strict comparison when testing for null values in the array
  217. |--------------------------------------------------------------------------
  218. */
  219. 'strictNullComparison' => false
  220. ],
  221. /*
  222. |--------------------------------------------------------------------------
  223. | Store settings
  224. |--------------------------------------------------------------------------
  225. */
  226. 'store' => [
  227. /*
  228. |--------------------------------------------------------------------------
  229. | Path
  230. |--------------------------------------------------------------------------
  231. |
  232. | The path we want to save excel file to
  233. |
  234. */
  235. 'path' => storage_path('exports'),
  236. /*
  237. |--------------------------------------------------------------------------
  238. | Return info
  239. |--------------------------------------------------------------------------
  240. |
  241. | Whether we want to return information about the stored file or not
  242. |
  243. */
  244. 'returnInfo' => false
  245. ],
  246. /*
  247. |--------------------------------------------------------------------------
  248. | PDF Settings
  249. |--------------------------------------------------------------------------
  250. */
  251. 'pdf' => [
  252. /*
  253. |--------------------------------------------------------------------------
  254. | PDF Drivers
  255. |--------------------------------------------------------------------------
  256. | Supported: DomPDF, tcPDF, mPDF
  257. */
  258. 'driver' => 'DomPDF',
  259. /*
  260. |--------------------------------------------------------------------------
  261. | PDF Driver settings
  262. |--------------------------------------------------------------------------
  263. */
  264. 'drivers' => [
  265. /*
  266. |--------------------------------------------------------------------------
  267. | DomPDF settings
  268. |--------------------------------------------------------------------------
  269. */
  270. 'DomPDF' => [
  271. 'path' => base_path('vendor/dompdf/dompdf/')
  272. ],
  273. /*
  274. |--------------------------------------------------------------------------
  275. | tcPDF settings
  276. |--------------------------------------------------------------------------
  277. */
  278. 'tcPDF' => [
  279. 'path' => base_path('vendor/tecnick.com/tcpdf/')
  280. ],
  281. /*
  282. |--------------------------------------------------------------------------
  283. | mPDF settings
  284. |--------------------------------------------------------------------------
  285. */
  286. 'mPDF' => [
  287. 'path' => base_path('vendor/mpdf/mpdf/')
  288. ],
  289. ]
  290. ]
  291. ],
  292. 'filters' => [
  293. /*
  294. |--------------------------------------------------------------------------
  295. | Register read filters
  296. |--------------------------------------------------------------------------
  297. */
  298. 'registered' => [
  299. 'chunk' => 'Maatwebsite\Excel\Filters\ChunkReadFilter'
  300. ],
  301. /*
  302. |--------------------------------------------------------------------------
  303. | Enable certain filters for every file read
  304. |--------------------------------------------------------------------------
  305. */
  306. 'enabled' => []
  307. ],
  308. 'import' => [
  309. /*
  310. |--------------------------------------------------------------------------
  311. | Has heading
  312. |--------------------------------------------------------------------------
  313. |
  314. | The sheet has a heading (first) row which we can use as attribute names
  315. |
  316. | Options: true|false|slugged|slugged_with_count|ascii|numeric|hashed|trans|original
  317. |
  318. */
  319. 'heading' => 'slugged',
  320. /*
  321. |--------------------------------------------------------------------------
  322. | First Row with data or heading of data
  323. |--------------------------------------------------------------------------
  324. |
  325. | If the heading row is not the first row, or the data doesn't start
  326. | on the first row, here you can change the start row.
  327. |
  328. */
  329. 'startRow' => 1,
  330. /*
  331. |--------------------------------------------------------------------------
  332. | Cell name word separator
  333. |--------------------------------------------------------------------------
  334. |
  335. | The default separator which is used for the cell names
  336. | Note: only applies to 'heading' settings 'true' && 'slugged'
  337. |
  338. */
  339. 'separator' => '_',
  340. /*
  341. |--------------------------------------------------------------------------
  342. | Include Charts during import
  343. |--------------------------------------------------------------------------
  344. */
  345. 'includeCharts' => false,
  346. /*
  347. |--------------------------------------------------------------------------
  348. | Sheet heading conversion
  349. |--------------------------------------------------------------------------
  350. |
  351. | Convert headings to ASCII
  352. | Note: only applies to 'heading' settings 'true' && 'slugged'
  353. |
  354. */
  355. 'to_ascii' => true,
  356. /*
  357. |--------------------------------------------------------------------------
  358. | Import encoding
  359. |--------------------------------------------------------------------------
  360. */
  361. 'encoding' => [
  362. 'input' => 'UTF-8',
  363. 'output' => 'UTF-8'
  364. ],
  365. /*
  366. |--------------------------------------------------------------------------
  367. | Calculate
  368. |--------------------------------------------------------------------------
  369. |
  370. | By default cells with formulas will be calculated.
  371. |
  372. */
  373. 'calculate' => true,
  374. /*
  375. |--------------------------------------------------------------------------
  376. | Ignore empty cells
  377. |--------------------------------------------------------------------------
  378. |
  379. | By default empty cells are not ignored
  380. |
  381. */
  382. 'ignoreEmpty' => false,
  383. /*
  384. |--------------------------------------------------------------------------
  385. | Force sheet collection
  386. |--------------------------------------------------------------------------
  387. |
  388. | For a sheet collection even when there is only 1 sheets.
  389. | When set to false and only 1 sheet found, the parsed file will return
  390. | a row collection instead of a sheet collection.
  391. | When set to true, it will return a sheet collection instead.
  392. |
  393. */
  394. 'force_sheets_collection' => false,
  395. /*
  396. |--------------------------------------------------------------------------
  397. | Date format
  398. |--------------------------------------------------------------------------
  399. |
  400. | The format dates will be parsed to
  401. |
  402. */
  403. 'dates' => [
  404. /*
  405. |--------------------------------------------------------------------------
  406. | Enable/disable date formatting
  407. |--------------------------------------------------------------------------
  408. */
  409. 'enabled' => true,
  410. /*
  411. |--------------------------------------------------------------------------
  412. | Default date format
  413. |--------------------------------------------------------------------------
  414. |
  415. | If set to false, a carbon object will return
  416. |
  417. */
  418. 'format' => false,
  419. /*
  420. |--------------------------------------------------------------------------
  421. | Date columns
  422. |--------------------------------------------------------------------------
  423. */
  424. 'columns' => []
  425. ],
  426. /*
  427. |--------------------------------------------------------------------------
  428. | Import sheets by config
  429. |--------------------------------------------------------------------------
  430. */
  431. 'sheets' => [
  432. /*
  433. |--------------------------------------------------------------------------
  434. | Example sheet
  435. |--------------------------------------------------------------------------
  436. |
  437. | Example sheet "test" will grab the firstname at cell A2
  438. |
  439. */
  440. 'test' => [
  441. 'firstname' => 'A2'
  442. ]
  443. ]
  444. ],
  445. 'views' => [
  446. /*
  447. |--------------------------------------------------------------------------
  448. | Styles
  449. |--------------------------------------------------------------------------
  450. |
  451. | The default styles which will be used when parsing a view
  452. |
  453. */
  454. 'styles' => [
  455. /*
  456. |--------------------------------------------------------------------------
  457. | Table headings
  458. |--------------------------------------------------------------------------
  459. */
  460. 'th' => [
  461. 'font' => [
  462. 'bold' => true,
  463. 'size' => 12,
  464. ]
  465. ],
  466. /*
  467. |--------------------------------------------------------------------------
  468. | Strong tags
  469. |--------------------------------------------------------------------------
  470. */
  471. 'strong' => [
  472. 'font' => [
  473. 'bold' => true,
  474. 'size' => 12,
  475. ]
  476. ],
  477. /*
  478. |--------------------------------------------------------------------------
  479. | Bold tags
  480. |--------------------------------------------------------------------------
  481. */
  482. 'b' => [
  483. 'font' => [
  484. 'bold' => true,
  485. 'size' => 12,
  486. ]
  487. ],
  488. /*
  489. |--------------------------------------------------------------------------
  490. | Italic tags
  491. |--------------------------------------------------------------------------
  492. */
  493. 'i' => [
  494. 'font' => [
  495. 'italic' => true,
  496. 'size' => 12,
  497. ]
  498. ],
  499. /*
  500. |--------------------------------------------------------------------------
  501. | Heading 1
  502. |--------------------------------------------------------------------------
  503. */
  504. 'h1' => [
  505. 'font' => [
  506. 'bold' => true,
  507. 'size' => 24,
  508. ]
  509. ],
  510. /*
  511. |--------------------------------------------------------------------------
  512. | Heading 2
  513. |--------------------------------------------------------------------------
  514. */
  515. 'h2' => [
  516. 'font' => [
  517. 'bold' => true,
  518. 'size' => 18,
  519. ]
  520. ],
  521. /*
  522. |--------------------------------------------------------------------------
  523. | Heading 2
  524. |--------------------------------------------------------------------------
  525. */
  526. 'h3' => [
  527. 'font' => [
  528. 'bold' => true,
  529. 'size' => 13.5,
  530. ]
  531. ],
  532. /*
  533. |--------------------------------------------------------------------------
  534. | Heading 4
  535. |--------------------------------------------------------------------------
  536. */
  537. 'h4' => [
  538. 'font' => [
  539. 'bold' => true,
  540. 'size' => 12,
  541. ]
  542. ],
  543. /*
  544. |--------------------------------------------------------------------------
  545. | Heading 5
  546. |--------------------------------------------------------------------------
  547. */
  548. 'h5' => [
  549. 'font' => [
  550. 'bold' => true,
  551. 'size' => 10,
  552. ]
  553. ],
  554. /*
  555. |--------------------------------------------------------------------------
  556. | Heading 6
  557. |--------------------------------------------------------------------------
  558. */
  559. 'h6' => [
  560. 'font' => [
  561. 'bold' => true,
  562. 'size' => 7.5,
  563. ]
  564. ],
  565. /*
  566. |--------------------------------------------------------------------------
  567. | Hyperlinks
  568. |--------------------------------------------------------------------------
  569. */
  570. 'a' => [
  571. 'font' => [
  572. 'underline' => true,
  573. 'color' => ['argb' => 'FF0000FF'],
  574. ]
  575. ],
  576. /*
  577. |--------------------------------------------------------------------------
  578. | Horizontal rules
  579. |--------------------------------------------------------------------------
  580. */
  581. 'hr' => [
  582. 'borders' => [
  583. 'bottom' => [
  584. 'style' => 'thin',
  585. 'color' => ['FF000000']
  586. ],
  587. ]
  588. ]
  589. ]
  590. ]
  591. );