private function getXmlString(array $fields = []): string
    {
        $xmlData = [];
        $xmlData[] = '<Row>';
        foreach ($fields as $key => $value) {
            $value = htmlspecialchars($value);

            $value = str_replace(["\r\n", "\r", "\n"], '&#10;', $value);
            $dataType = 'String';
            if (0 !== $this->position || !$this->showHeaders) {
                $dataType = $this->getDataType((string) $key, $value);
            }
            $xmlData[] = '<Cell><Data ss:Type="'.$dataType.'">'.$value.'</Data></Cell>';
        }
        $xmlData[] = '</Row>';

        return implode('', $xmlData);
    }
private function getXmlString(array $fields = []): string
    {
        $xmlData = [];
        $xmlData[] = '<Row>';
        foreach ($fields as $key => $value) {
            $value = htmlspecialchars($value);

            $value = str_replace(["\r\n", "\r", "\n"], '&#10;', $value);
            $dataType = 'String';
            if (0 !== $this->position || !$this->showHeaders) {
                $dataType = $this->getDataType((string) $key, $value);
            }
            $xmlData[] = '<Cell><Data ss:Type="'.$dataType.'">'.$value.'</Data></Cell>';
        }
        $xmlData[] = '</Row>';

        return implode('', $xmlData);
    }
private function getXmlString ( array $ fields = [ ] ) : string { $ xmlData = [ ] ; $ xmlData [ ] = '<Row>' ; foreach ( $ fields as $ key => $ value ) { $ value = htmlspecialchars ( $ value ) ; $ value = str_replace ( [ "\r\n" , "\r" , "\n" ] , '&#10;' , $ value ) ; $ dataType = 'String' ; if ( 0 !== $ this -> position || ! $ this -> showHeaders ) { $ dataType = $ this -> getDataType ( ( string ) $ key , $ value ) ; } $ xmlData [ ] = '<Cell><Data ss:Type="' . $ dataType . '">' . $ value . '</Data></Cell>' ; } $ xmlData [ ] = '</Row>' ; return implode ( '' , $ xmlData ) ; }
Prepare and return XML string for MS Excel XML from array.
Prepare and return XML string for MS Excel XML from array .