php - Create File with Chart, and dynamic number of columns -


i creating xlsx-file, , want add column chart, displaying 2 values calenderweek.

however, don't know how many charts (depending on items available) , how many calenderweeks i'll have display (depending on time-frame selected user).

creating weeks , data-table not problem, working fine, iterating through data 2 nested foreach-loops, using setcellvaluebycolumnandrow().

my problem is, have dynamic number of columns , dynamic number of rows. need hint, how transfer

$value = new phpexcel_chart_dataseriesvalues('number',     'worksheet!$c$9:$h$9',     null,     $numberofweeks);  array_push($values, $value); 

into this:

$value = new phpexcel_chart_dataseriesvalues('number',  'worksheet!$' . $start_column . '$' . $current_row . ':$' . $end_column . '$' . $current_row, null, $numberofweeks);   array_push($values, $value); 

how create chart , dynamic number of columns?

edit:

within snippet, there missing "!" (thanks mark barker). fixed in first post. because using integer-values iterate through colums, had convert integer letter. a solution posted here. in meantime, mark poked nose function, build in of course ;-) , phpexcel_cell::stringfromcolumnindex()

missing ! after worksheet obvious problem.... ms excel cares such things.... , missing $ absolute references:

$value = new phpexcel_chart_dataseriesvalues('number',     'worksheet!$' . $start_column . '$' . $current_row . ':$' . $end_column . '$' . $current_row,     null,     $numberofweeks);  

but simple matter of php string concatenation 101


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -