# PHPExcel創建文檔時的基本屬性
* * * * *
## 設置excel的屬性:
~~~
//創建人
$phpexcel->getProperties()->setCreator("文檔創建人");
//最后修改人
$phpexcel->getProperties()->setLastModifiedBy("最后修改人");
//標題
$phpexcel->getProperties()->setTitle("文檔標題");
//題目
$phpexcel->getProperties()->setSubject("題目");
//描述
$phpexcel->getProperties()->setDescription("文檔的描述");
//關鍵字
$phpexcel->getProperties()->setKeywords("關鍵字");
//種類
$phpexcel->getProperties()->setCategory("這個是文檔的種類")
~~~
> 導出excel文件
~~~
$phpwriter = new PHPExcel_Writer_Excel5($objPHPExcel);
$phpwriter->save('php://output');
~~~
## 中文亂碼的處理
在設置文檔屬生時,可能會產生中文亂碼,文檔生成或導出時需要提前做一下亂碼處理。
中文亂碼處理請看下一章節