Beispiel #1
0
 /**
  * @test
  * @covers Plum\PlumExcel\ExcelWriter::autoDetectHeader()
  * @covers Plum\PlumExcel\ExcelWriter::writeItem()
  * @expectedException \InvalidArgumentException
  */
 public function writeItemThrowsExceptionIfAutoDetectHeaderIsTrueAndItemIsNotArray()
 {
     $this->writer->autoDetectHeader();
     $this->writer->writeItem(new \stdClass());
 }
Beispiel #2
0
<?php

/**
 * This file is part of plumphp/plum-excel.
 *
 * (c) Florian Eckerstorfer <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require_once __DIR__ . '/../vendor/autoload.php';
use Plum\PlumExcel\ExcelWriter;
$writer = new ExcelWriter(__DIR__ . '/example.xlsx');
$writer->autoDetectHeader();
$writer->prepare();
$writer->writeItem(['Town' => 'Vienna', 'Country' => 'Austria', 'District' => 'Alsergrund', 'DistrictNumber' => 1090]);
$writer->writeItem(['Town' => 'Vienna', 'Country' => 'Austria', 'District' => 'Mariahilf', 'DistrictNumber' => 1060]);
$writer->finish();