Commit 58bc0265 authored by Liu lu's avatar Liu lu

Vtiful\Kernel\Excel 优化

parent 4a6ce053
......@@ -47,17 +47,17 @@ class KernelExcelExportService
private $dataRowStart =2; //起始行
/**
*
* @param $sheetName
* KernelExcelExportService constructor.
* @param $dir 文件存储目录
* @param $fileName 导出文件名 默认加上时间
*/
public function __construct($dir,$fileName)
public function __construct($dir,$fileName,$sheetName='Sheet1')
{
$fileName = "{$fileName}_" .date('YmdHis') . '.xlsx';
$dir = BASE_PATH . '/public/export/'.$dir;
!is_dir($dir) && !mkdir($dir, 0777, true); //不存在则创建
$this->fileObject = (new \Vtiful\Kernel\Excel(['path' => $dir]))->constMemory($fileName);
$this->fileObject = (new \Vtiful\Kernel\Excel(['path' => $dir]))->constMemory($fileName,$sheetName);
}
/**
......@@ -68,6 +68,12 @@ class KernelExcelExportService
return $this->fileObject;
}
public function addSheet($sheetName)
{
$this->dataRowStart=2;
$this->fileObject->addSheet($sheetName);
}
/**
* 设置居中样式
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment