API-GENERATOR

Kembali
Reset Reset Kode

                            
use PhpOffice\PhpSpreadsheet\Spreadsheet;
    use PhpOffice\PhpSpreadsheet\IOFactory;
    use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
    // Create new Spreadsheet object
    $spreadsheet = new Spreadsheet();
    $spreadsheet->getProperties()->setCreator("Codekop - Web - Android")
        ->setLastModifiedBy("Codekop - Web - Android")
        ->setTitle("Office 2007 XLSX Test Document")
        ->setSubject("Office 2007 XLSX Test Document")
        ->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")
        ->setKeywords("office 2007 openxml php")
        ->setCategory("Test result file");

    $boldFont = [
        "font" => [
            "bold" => true
            // "color" => ["argb" => "0000FF"],
        ],
    ];

    $totalStyle = [
        "font" => [
            "bold" => true,
            "color" => ["argb" => "0000FF"],
        ],
    ];

    $allBorderStyle = [
        "borders" => [
            "allBorders" => [
                "borderStyle" => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
                "color" => ["argb" => "00000000"],
            ],
        ],
    ];

    $outlineBorderStyle = [
        "borders" => [
            "outline" => [
                "borderStyle" => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
                "color" => ["argb" => "00000000"],
            ],
        ],
    ];

    $topBorderStyle = [
        "borders" => [
            "top" => [
                "borderStyle" => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
                "color" => ["argb" => "00000000"],
            ],
        ],
    ];

    $bottomBorderStyle = [
        "borders" => [
            "bottom" => [
                "borderStyle" => \PhpOffice\PhpSpreadsheet\Style\Border::BORDER_THIN,
                "color" => ["argb" => "00000000"],
            ],
        ],
    ];

    $center = array();
    $center["alignment"] = array();
    $center["alignment"]["horizontal"] = \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER;
    $center["alignment"]["vertical"] = \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER;

    $right = array();
    $right["alignment"] = array();
    $right["alignment"]["horizontal"] = \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_RIGHT;
    $right["alignment"]["vertical"] = \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER;

    $left = array();
    $left["alignment"] = array();
    $left["alignment"]["horizontal"] = \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_LEFT;
    $left["alignment"]["vertical"] = \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER;