PHP code example of cyberclick-os / excel-bundle

1. Go to this page and download the library: Download cyberclick-os/excel-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cyberclick-os / excel-bundle example snippets


$writer = $this->get('phpspreadsheet')->createWriter($spreadsheet, 'Xls');
$writer->save('file.xls');

$writer = $this->get('phpspreadsheet')->createWriter($spreadsheet, 'Xlsx');
$response = $this->get('phpspreadsheet')->createStreamedResponse($writer);

$writer = $this->get('phpspreadsheet')->createSpreadSheet();
$writer->setActiveSheetIndex(0);
$activesheet = $writer->getActiveSheet();
$drawingobject = $this->get('phpspreadsheet')->createSpreadsheetWorksheetDrawing();
$drawingobject->setPath('/path/to/image')
    ->setName('Image name')
    ->setDescription('Image description')
    ->setHeight(60)
    ->setOffsetY(20)
    ->setCoordinates('A1')
    ->setWorksheet($activesheet);

$reader = $this->get('phpspreadsheet')->createReader('Xlsx');
 php
    $bundles = array(
        // ...
        new \Onurb\Bundle\ExcelBundle\OnurbExcelBundle(),
    );
 php
    // config/bundles.php
     return [
         // ...
         Onurb\Bundle\ExcelBundle\OnurbExcelBundle::class => ['all' => true],
     ];
 
 php
$spreadsheet = $this->get('phpspreadsheet')->createSpreadsheet();
 php
$spreadsheet = $this->get('phpspreadsheet')->createSpreadsheet('file.xlsx');