我使用以下代码将数据显示到Excel工作表中。现在我需要在Excel工作表中显示徽标吗?怎么做?
$info_excel=$_REQUEST['excel_info'];
$month=$_REQUEST['m']; $year=$_REQUEST['y'];
$num = cal_days_in_month(CAL_GREGORIAN, $month,$year);
Yii::import('application.extensions.phpexcel1.JPhpExcel');
$xls = new JPhpExcel('UTF-8', false, 'My Test Sheet');
$image="<img src='".Yii::app()->request->baseUrl.'/themes/optisol/images/resign-icon.png'."'/>";
$heading=array(
1=>array(" Attendance for 01"."-".$month."-".$year." To ".$num."-".$month."-".$year." "),
);
$value=array(
1=>array('User Id', 'Emp No','Name','Branch','Designiation','Department','Present Day','Holiday','Leave Day','Week Day','Lop'),
);
$xls->addArray($heading);
$xls->addArray($value);
$xls->addArray($info_excel);
$xls->generateXML('attendance');
答案 0 :(得分:0)
在视图组件中尝试将编码作为简单布局,然后在代码末尾尝试此操作
//code goes here
$this->layout=false;
Yii::import('application.extensions.phpexcel.JPhpExcel');
$xls = new JPhpExcel('UTF-8', false);
$xls->generateXML('name_of_the_sheet');
//end of the view
这将生成一个要保存的Excel文件