Sonata\Exporter\Writer\XmlExcelWriter::close PHP Method

close() public method

public close ( )
    public function close()
    {
        fwrite($this->file, $this->footer);
        fclose($this->file);
    }

Usage Example

 public function testSpecificTypes()
 {
     // define type for specific cell
     $writer = new XmlExcelWriter($this->filename, false, array('year' => 'String', 'surname' => 'Number'));
     $writer->open();
     $writer->write(array('name' => 'john', 'surname' => 'doe ', 'year' => '2001'));
     $writer->close();
     $expected = '<Row><Cell><Data ss:Type="String">john</Data></Cell><Cell><Data ss:Type="Number">doe </Data></Cell><Cell><Data ss:Type="String">2001</Data></Cell></Row>';
     $this->assertTrue(strstr(file_get_contents($this->filename), $expected) !== false);
 }