Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions xlsxwriter.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,13 @@ public function writeSheetRow($sheet_name, array $row, $row_options=null)
if (empty($sheet_name))
return;

self::initializeSheet($sheet_name);
$row_widths = isset($row_options['widths']) ? (array)$row_options['widths'] : array();
$auto_filter = isset($row_options['auto_filter']) ? intval($row_options['auto_filter']) : false;
$freeze_rows = isset($row_options['freeze_rows']) ? intval($row_options['freeze_rows']) : false;
$freeze_columns = isset($row_options['freeze_columns']) ? intval($row_options['freeze_columns']) : false;

self::initializeSheet($sheet_name, $row_widths, $auto_filter, $freeze_rows, $freeze_columns);

$sheet = &$this->sheets[$sheet_name];
if (count($sheet->columns) < count($row)) {
$default_column_types = $this->initializeColumnTypes( array_fill($from=0, $until=count($row), 'GENERAL') );//will map to n_auto
Expand All @@ -258,9 +264,9 @@ public function writeSheetRow($sheet_name, array $row, $row_options=null)
if (!empty($row_options))
{
$ht = isset($row_options['height']) ? floatval($row_options['height']) : 12.1;
$customHt = isset($row_options['height']) ? true : false;
$hidden = isset($row_options['hidden']) ? (bool)($row_options['hidden']) : false;
$collapsed = isset($row_options['collapsed']) ? (bool)($row_options['collapsed']) : false;
$customHt = isset($row_options['height']) ? 'true' : 'false';
$hidden = isset($row_options['hidden']) ? (bool)($row_options['hidden']) : 'false';
$collapsed = isset($row_options['collapsed']) ? (bool)($row_options['collapsed']) : 'false';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this still does not use the right value when passing the options (as they are still boolean there rather than strings)

$sheet->file_writer->write('<row collapsed="'.($collapsed).'" customFormat="false" customHeight="'.($customHt).'" hidden="'.($hidden).'" ht="'.($ht).'" outlineLevel="0" r="' . ($sheet->row_count + 1) . '">');
}
else
Expand All @@ -271,7 +277,9 @@ public function writeSheetRow($sheet_name, array $row, $row_options=null)
$style = &$row_options;
$c=0;
foreach ($row as $v) {
$number_format = $sheet->columns[$c]['number_format'];
if (isset($row_options['row-format'])) { $number_format = $row_options['row-format'][$c]; }
else { $number_format = $sheet->columns[$c]['number_format']; }

$number_format_type = $sheet->columns[$c]['number_format_type'];
$cell_style_idx = empty($style) ? $sheet->columns[$c]['default_cell_style'] : $this->addCellStyle( $number_format, json_encode(isset($style[0]) ? $style[$c] : $style) );
$this->writeCell($sheet->file_writer, $sheet->row_count, $c, $v, $number_format_type, $cell_style_idx);
Expand Down