SimpleExcel\Writer\XMLWriter::addRow PHP Method

addRow() public method

Adding row data to XML
public addRow ( array $values ) : void
$values array An array contains ordered value for every cell
return void
    public function addRow($values)
    {
        $row =& $this->tabl_data;
        $row .= '
    <Row ss:AutoFitHeight="0">';
        foreach ($values as $val) {
            $value = '';
            $datatype = 'String';
            // check if given variable contains array
            if (is_array($val)) {
                $value = $val[0];
                $datatype = $val[1];
            } else {
                $value = $val;
                $datatype = is_numeric($val) ? 'Number' : 'String';
            }
            // escape value from HTML tags
            $value = filter_var($value, FILTER_SANITIZE_SPECIAL_CHARS);
            $row .= '
    <Cell><Data ss:Type="' . $datatype . '">' . $value . '</Data></Cell>';
        }
        $row .= '
    </Row>';
    }