php - phpexcel set data type on range of cells -
with phpexcel, i'm using:
$worksheet->fromarray($array)
;
to set data. however, 1 column needs set string (a number leading zero, leading 0 gets cut off if not set string). if wasn't using fromarray
method, set data type using phpexcel_worksheet::setcellvalueexplicit()
.
however, want using range of columns. ideally this:
$worksheet->getcell('a1:a50')->setdatatype(phpexcel_cell_datatype::type_string);
but looking @ code, getcell
won't allow range, single cell. how can this?
there no method in phpexcel allow set data type range of cells, individual cell.
there couple of options... harder write custom cell value binder automatically sets data type cells string when cell value set fromarray().
what instead (and far easier), leave datatype number, , value numeric, set number format mask tells excel display numbers leading zeroes.
$objphpexcel->getactivesheet()->getstyle('l3:n2048') ->getnumberformat()->setformatcode('0000');
Comments
Post a Comment