77/**
88 * An excel sheet that is rendered with data from an `ActiveQuery`.
99 * A query must be set with `setQuery()`.
10+ *
11+ * Note that for backwards compatibility this class still uses 0-based column
12+ * indices for its configuration properties while PhpSpreadsheet now is 1-based.
1013 */
1114class ActiveExcelSheet extends ExcelSheet
1215{
@@ -58,7 +61,7 @@ public function getData()
5861 }
5962
6063 /**
61- * @return string[] list of attributes for the table columns. If no
64+ * @return string[] 0-based list of attributes for the table columns. If no
6265 * attributes are set, attributes are set to `ActiveRecord::attributes()`
6366 * for the main query record.
6467 */
@@ -71,7 +74,7 @@ public function getAttributes()
7174 }
7275
7376 /**
74- * @param string[] $value list of attributes for the table columns
77+ * @param string[] $value 0-based list of attributes for the table columns
7578 */
7679 public function setAttributes ($ value )
7780 {
@@ -130,8 +133,8 @@ public function getFormats()
130133 {
131134 if ($ this ->_formats === null ) {
132135 $ this ->_formats = [];
133- $ attrs = $ this ->normalizeIndex ( $ this -> getAttributes () );
134- $ schemas = $ this ->normalizeIndex ( $ this -> getColumnSchemas () );
136+ $ attrs = $ this ->getAttributes ();
137+ $ schemas = $ this ->getColumnSchemas ();
135138 foreach ($ attrs as $ c => $ attr ) {
136139 if (!isset ($ schemas [$ c ])) {
137140 continue ;
@@ -176,15 +179,15 @@ public function setFormats($value)
176179
177180 /**
178181 * @return Callable[] the value formatters for the column cells indexed by
179- * 0-based column index. If not set, the formatters are aut -generated from
182+ * 0-based column index. If not set, the formatters are auto -generated from
180183 * the DB column types.
181184 */
182185 public function getFormatters ()
183186 {
184187 if ($ this ->_formatters === null ) {
185188 $ this ->_formatters = [];
186- $ attrs = $ this ->normalizeIndex ( $ this -> getAttributes () );
187- $ schemas = $ this ->normalizeIndex ( $ this -> getColumnSchemas () );
189+ $ attrs = $ this ->getAttributes ();
190+ $ schemas = $ this ->getColumnSchemas ();
188191 foreach ($ attrs as $ c => $ attr ) {
189192 if (!isset ($ schemas [$ c ])) {
190193 continue ;
0 commit comments