You are here

API.txt in PHPExcel 6

Same filename and directory in other branches
  1. 6.2 API.txt

Provide documentation to phpexcel hooks.

phpexcel provides several hooks which can allow a developer to have more control over the export or import.

File

API.txt
View source
  1. /**
  2. * @file
  3. * Provide documentation to phpexcel hooks.
  4. *
  5. * phpexcel provides several hooks which can allow a developer to have more
  6. * control over the export or import.
  7. */
  8. /**
  9. * Export
  10. *
  11. * @param string $op
  12. * The current operation
  13. * @param array|string &$data
  14. * The data. Depends on the operation. See documentation below for more
  15. * information
  16. * @param PHPExcel|PHPExcel_Worksheet &$phpexcel
  17. * The current object used. Can either be a PHPExcel object when working
  18. * with the excel file in general or a PHPExcel_Worksheet object when
  19. * iterating through the worksheets.
  20. * @param array $options
  21. * The options for the phpexcel module
  22. * @param int $column
  23. * (optional) the column number
  24. * @param int $row
  25. * (optional) the row number
  26. */
  27. function hook_phpexcel_export($op, &$data, &$phpexcel, $options, $column = NULL, $row = NULL) {
  28. switch ($op) {
  29. case 'headers':
  30. /**
  31. * The $data parameter will contain the headers in array form. The headers
  32. * have not been added to the document yet and can be altered at this
  33. * point.
  34. *
  35. * The $phpexcel parameter will contain the PHPExcel object.
  36. */
  37. break;
  38. case 'new sheet':
  39. /**
  40. * The $data parameter will contain the sheet ID. This is a new sheet and
  41. * can be altered.
  42. *
  43. * The $phpexcel parameter will contain the PHPExcel_Worksheet object.
  44. */
  45. break;
  46. case 'data':
  47. /**
  48. * The $data parameter contains all the data to be exported as a
  49. * 3-dimensional array. The data has not been exported yet and can be
  50. * altered at this point.
  51. *
  52. * The $phpexcel parameter contains the PHPExcel object
  53. */
  54. break;
  55. case 'pre cell':
  56. /**
  57. * The $data parameter contains the call value to be rendered. The value
  58. * has not been added yet and can still be altered.
  59. *
  60. * The $phpexcel parameter contains the PHPExcel_Worksheet object.
  61. *
  62. * The $column and $row parameters are set.
  63. */
  64. break;
  65. case 'post cell':
  66. /**
  67. * The $data parameter contains the call value that was rendered. This
  68. * value can not be altered anymore.
  69. *
  70. * The $phpexcel parameter contains the PHPExcel_Worksheet object.
  71. *
  72. * The $column and $row parameters are set.
  73. */
  74. break;
  75. }
  76. }
  77. /**
  78. * Import
  79. *
  80. * @param string $op
  81. * The current operation
  82. * @param * &$data
  83. * The data. Depends on the operation. See documentation below for more
  84. * information
  85. * @param PHPExcel_Reader|PHPExcel_Worksheet|PHPExcel_Cell &$phpexcel
  86. * The current object used. Can either be a PHPExcel_Reader object when
  87. * loading the Excel file, a PHPExcel_Worksheet object when iterating
  88. * through the worksheets or a PHPExcel_Cell object when reading data
  89. * from a cell
  90. * @param array $options
  91. * The options for the phpexcel import
  92. * @param int $column
  93. * (optional) the column number
  94. * @param int $row
  95. * (optional) the row number
  96. */
  97. function hook_phpexcel_import($op, &$data, &$phpexcel, $options, $column = NULL, $row = NULL) {
  98. switch ($op) {
  99. case 'full':
  100. /**
  101. * The $data parameter will contain the fully loaded Excel file, returned
  102. * by the PHPExcel_Reader object.
  103. *
  104. * The $phpexcel parameter will contain the PHPExcel_Reader object.
  105. */
  106. break;
  107. case 'sheet':
  108. /**
  109. * The $data parameter will contain the current PHPExcel_Worksheet.
  110. *
  111. * The $phpexcel parameter will contain the PHPExcel_Reader object.
  112. */
  113. break;
  114. case 'row':
  115. /**
  116. * The $data parameter will contain the current PHPExcel_Row.
  117. *
  118. * The $phpexcel parameter will contain the PHPExcel_Reader object.
  119. */
  120. break;
  121. case 'pre cell':
  122. /**
  123. * The $data parameter will contain the current cell value. The value has
  124. * not been added to the data array and can still be altered.
  125. *
  126. * The $phpexcel parameter will contain the PHPExcel_Cell object.
  127. *
  128. * The $column and $row parameters are set.
  129. */
  130. break;
  131. case 'post cell':
  132. /**
  133. * The $data parameter will contain the current cell value inside the data
  134. * array. The value can be altered.
  135. *
  136. * The $phpexcel parameter will contain the PHPExcel_Cell object.
  137. *
  138. * The $column and $row parameters are set.
  139. */
  140. break;
  141. }
  142. }