PHP code example of fly321 / excel-annotation-export

1. Go to this page and download the library: Download fly321/excel-annotation-export 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/ */

    

fly321 / excel-annotation-export example snippets


class FlyColumn
{
    #[ExcelColumnAnnotation(columnWidth: 20, columnName: 'area', columnFieldMapping: '地区')]
    public string $area;
    #[ExcelColumnAnnotation(columnName: 'country', columnFieldMapping: '国家', columnWidth: 30)]
    public string $country;
    #[ExcelColumnAnnotation(columnName: 'title', columnFieldMapping: '标题', columnWidth: 40)]
    public string $title;
}

writeOrExportExcel(
            \Tests\FlyColumn::class,
            'fly_table',
            [
                ['country' => 'China', 'title' => 'Beijing', 'area' => 'Asia'],
                ['area' => 'Asia', 'country' => 'Japan', 'title' => 'Tokyo'],
                ['area' => 'Europe', 'country' => 'France', 'title' => 'Paris'],
            ],
            true, "fly_table.xlsx");