templates/example.controller.php
public function actionExportExcel2()
    {
        $searchModel = new MahasiswaSearch();
        $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
        
        // Initalize the TBS instance
        $OpenTBS = new \hscstudio\export\OpenTBS; // new instance of TBS
        // Change with Your template kaka
		$template = Yii::getAlias('@hscstudio/export').'/templates/opentbs/ms-excel.xlsx';
        $OpenTBS->LoadTemplate($template); // Also merge some [onload] automatic fields (depends of the type of document).
        //$OpenTBS->VarRef['modelName']= "Mahasiswa";				
        $data = [];
        $no=1;
        foreach($dataProvider->getModels() as $mahasiswa){
            $data[] = [
                'no'=>$no++,
                'nama'=>$mahasiswa->nama,
                'nim'=>$mahasiswa->nim,
            ];
        }
        
        $data2[0] = [
                'no'=>'X',
                'nama'=>'Y',
                'nim'=>'Z',
            ];
        $data2[1] = [
                'no'=>'X',
                'nama'=>'Y',
                'nim'=>'Z',
            ];
        $OpenTBS->MergeBlock('data', $data);
        $OpenTBS->MergeBlock('data2', $data2);
        // Output the result as a file on the server. You can change output file
        $OpenTBS->Show(OPENTBS_DOWNLOAD, 'export.xlsx'); // Also merges all [onshow] automatic fields.			
        exit;
    }
public function actionExportExcel2()
    {
        $searchModel = new MahasiswaSearch();
        $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
        
        // Initalize the TBS instance
        $OpenTBS = new \hscstudio\export\OpenTBS; // new instance of TBS
        // Change with Your template kaka
		$template = Yii::getAlias('@hscstudio/export').'/templates/opentbs/ms-excel.xlsx';
        $OpenTBS->LoadTemplate($template); // Also merge some [onload] automatic fields (depends of the type of document).
        //$OpenTBS->VarRef['modelName']= "Mahasiswa";				
        $data = [];
        $no=1;
        foreach($dataProvider->getModels() as $mahasiswa){
            $data[] = [
                'no'=>$no++,
                'nama'=>$mahasiswa->nama,
                'nim'=>$mahasiswa->nim,
            ];
        }
        
        $data2[0] = [
                'no'=>'X',
                'nama'=>'Y',
                'nim'=>'Z',
            ];
        $data2[1] = [
                'no'=>'X',
                'nama'=>'Y',
                'nim'=>'Z',
            ];
        $OpenTBS->MergeBlock('data', $data);
        $OpenTBS->MergeBlock('data2', $data2);
        // Output the result as a file on the server. You can change output file
        $OpenTBS->Show(OPENTBS_DOWNLOAD, 'export.xlsx'); // Also merges all [onshow] automatic fields.			
        exit;
    }
/*
EXPORT WITH OPENTBS