excel.php 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704
  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|hashed_with_lower|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. | Slug whitelisting
  343. |--------------------------------------------------------------------------
  344. |
  345. | Here you can whitelist certain characters in the slug.
  346. | E.g. user.last_name will not remove . and _
  347. | Note: only applies to 'heading' settings 'true' && 'slugged'
  348. |
  349. */
  350. 'slug_whitelist' => '._',
  351. /*
  352. |--------------------------------------------------------------------------
  353. | Include Charts during import
  354. |--------------------------------------------------------------------------
  355. */
  356. 'includeCharts' => false,
  357. /*
  358. |--------------------------------------------------------------------------
  359. | Sheet heading conversion
  360. |--------------------------------------------------------------------------
  361. |
  362. | Convert headings to ASCII
  363. | Note: only applies to 'heading' settings 'true' && 'slugged'
  364. |
  365. */
  366. 'to_ascii' => true,
  367. /*
  368. |--------------------------------------------------------------------------
  369. | Import encoding
  370. |--------------------------------------------------------------------------
  371. */
  372. 'encoding' => [
  373. 'input' => 'UTF-8',
  374. 'output' => 'UTF-8'
  375. ],
  376. /*
  377. |--------------------------------------------------------------------------
  378. | Calculate
  379. |--------------------------------------------------------------------------
  380. |
  381. | By default cells with formulas will be calculated.
  382. |
  383. */
  384. 'calculate' => true,
  385. /*
  386. |--------------------------------------------------------------------------
  387. | Ignore empty cells
  388. |--------------------------------------------------------------------------
  389. |
  390. | By default empty cells are not ignored
  391. |
  392. */
  393. 'ignoreEmpty' => false,
  394. /*
  395. |--------------------------------------------------------------------------
  396. | Force sheet collection
  397. |--------------------------------------------------------------------------
  398. |
  399. | For a sheet collection even when there is only 1 sheets.
  400. | When set to false and only 1 sheet found, the parsed file will return
  401. | a row collection instead of a sheet collection.
  402. | When set to true, it will return a sheet collection instead.
  403. |
  404. */
  405. 'force_sheets_collection' => false,
  406. /*
  407. |--------------------------------------------------------------------------
  408. | Date format
  409. |--------------------------------------------------------------------------
  410. |
  411. | The format dates will be parsed to
  412. |
  413. */
  414. 'dates' => [
  415. /*
  416. |--------------------------------------------------------------------------
  417. | Enable/disable date formatting
  418. |--------------------------------------------------------------------------
  419. */
  420. 'enabled' => true,
  421. /*
  422. |--------------------------------------------------------------------------
  423. | Default date format
  424. |--------------------------------------------------------------------------
  425. |
  426. | If set to false, a carbon object will return
  427. |
  428. */
  429. 'format' => false,
  430. /*
  431. |--------------------------------------------------------------------------
  432. | Date columns
  433. |--------------------------------------------------------------------------
  434. */
  435. 'columns' => []
  436. ],
  437. /*
  438. |--------------------------------------------------------------------------
  439. | Import sheets by config
  440. |--------------------------------------------------------------------------
  441. */
  442. 'sheets' => [
  443. /*
  444. |--------------------------------------------------------------------------
  445. | Example sheet
  446. |--------------------------------------------------------------------------
  447. |
  448. | Example sheet "test" will grab the firstname at cell A2
  449. |
  450. */
  451. 'test' => [
  452. 'firstname' => 'A2'
  453. ]
  454. ]
  455. ],
  456. 'views' => [
  457. /*
  458. |--------------------------------------------------------------------------
  459. | Styles
  460. |--------------------------------------------------------------------------
  461. |
  462. | The default styles which will be used when parsing a view
  463. |
  464. */
  465. 'styles' => [
  466. /*
  467. |--------------------------------------------------------------------------
  468. | Table headings
  469. |--------------------------------------------------------------------------
  470. */
  471. 'th' => [
  472. 'font' => [
  473. 'bold' => true,
  474. 'size' => 12,
  475. ]
  476. ],
  477. /*
  478. |--------------------------------------------------------------------------
  479. | Strong tags
  480. |--------------------------------------------------------------------------
  481. */
  482. 'strong' => [
  483. 'font' => [
  484. 'bold' => true,
  485. 'size' => 12,
  486. ]
  487. ],
  488. /*
  489. |--------------------------------------------------------------------------
  490. | Bold tags
  491. |--------------------------------------------------------------------------
  492. */
  493. 'b' => [
  494. 'font' => [
  495. 'bold' => true,
  496. 'size' => 12,
  497. ]
  498. ],
  499. /*
  500. |--------------------------------------------------------------------------
  501. | Italic tags
  502. |--------------------------------------------------------------------------
  503. */
  504. 'i' => [
  505. 'font' => [
  506. 'italic' => true,
  507. 'size' => 12,
  508. ]
  509. ],
  510. /*
  511. |--------------------------------------------------------------------------
  512. | Heading 1
  513. |--------------------------------------------------------------------------
  514. */
  515. 'h1' => [
  516. 'font' => [
  517. 'bold' => true,
  518. 'size' => 24,
  519. ]
  520. ],
  521. /*
  522. |--------------------------------------------------------------------------
  523. | Heading 2
  524. |--------------------------------------------------------------------------
  525. */
  526. 'h2' => [
  527. 'font' => [
  528. 'bold' => true,
  529. 'size' => 18,
  530. ]
  531. ],
  532. /*
  533. |--------------------------------------------------------------------------
  534. | Heading 3
  535. |--------------------------------------------------------------------------
  536. */
  537. 'h3' => [
  538. 'font' => [
  539. 'bold' => true,
  540. 'size' => 13.5,
  541. ]
  542. ],
  543. /*
  544. |--------------------------------------------------------------------------
  545. | Heading 4
  546. |--------------------------------------------------------------------------
  547. */
  548. 'h4' => [
  549. 'font' => [
  550. 'bold' => true,
  551. 'size' => 12,
  552. ]
  553. ],
  554. /*
  555. |--------------------------------------------------------------------------
  556. | Heading 5
  557. |--------------------------------------------------------------------------
  558. */
  559. 'h5' => [
  560. 'font' => [
  561. 'bold' => true,
  562. 'size' => 10,
  563. ]
  564. ],
  565. /*
  566. |--------------------------------------------------------------------------
  567. | Heading 6
  568. |--------------------------------------------------------------------------
  569. */
  570. 'h6' => [
  571. 'font' => [
  572. 'bold' => true,
  573. 'size' => 7.5,
  574. ]
  575. ],
  576. /*
  577. |--------------------------------------------------------------------------
  578. | Hyperlinks
  579. |--------------------------------------------------------------------------
  580. */
  581. 'a' => [
  582. 'font' => [
  583. 'underline' => true,
  584. 'color' => ['argb' => 'FF0000FF'],
  585. ]
  586. ],
  587. /*
  588. |--------------------------------------------------------------------------
  589. | Horizontal rules
  590. |--------------------------------------------------------------------------
  591. */
  592. 'hr' => [
  593. 'borders' => [
  594. 'bottom' => [
  595. 'style' => 'thin',
  596. 'color' => ['FF000000']
  597. ],
  598. ]
  599. ]
  600. ]
  601. ]
  602. );