<?php public function setEncode($incode,$outcode){ $this->inEncode=$incode; $this->outEncode=$outcode; } public function setTitle($titlearr){ $title=""; foreach($titlearr as $v){ if($this->inEncode!=$this->outEncode){ $title.=iconv($this->inEncode,$this->outEncode,$v)."\t"; } else{ $title.=$v."\t"; } } $title.="\n"; return $title; }
使用方法
$excel=new Excel();
设置编码:
$excel->setEncode("utf-8","gb2312"); //如果不转码,参数写一样即可,例如$excel->setEncode("utf-8","utf-8");
设置标题栏
$titlearr=array("a","b","c","d");
设置内容栏
$contentarr=array(
1=>array("ab","ac","ad","ae"),
2=>array("abc","acc","adc","aec"),
3=>array("abd","acd","add","aed"),
4=>array("abe","ace","ade","aee"),
);
$excel->getExcel($titlearr,$contentarr,"abc");
本站所有资源均由网友贡献或各大下载网站转载。请自行检查软件的完整性!本站所有资源仅供学习参考。请不要将它们用于商业目的。否则,一切后果由您负责!如有侵权,请联系我们删除。联系方式:admin@php.cn
相关文章

01 Dec 2020
现在前端都可以进行excel文件的简单导入导出操作。下面是使用插件导出表格成excel文件示例组件是基于ng-alain封装的 XlsxService,XlsService是基于sheetjs开发的。

28 Sep 2018
本篇文章给大家带来的内容是关于php导出excel表格的方法分享(代码),有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。JavaScript中switch语句的简单介绍(附代码),有一定的参考价值,有需要的朋友可以参考一下,希望对你有所帮助。

01 Dec 2024
使用 Python 写入 Excel 电子表格:探索包和 CSV 选项在数据操作领域,需要将数据导出到 Excel...

13 May 2021
方法:首先打开需要进行操作的excel表格,选择sheet表格;然后点击鼠标右键,在弹出的右键菜单中选择“取消隐藏”;接着按住键盘上的“shift”键,同时选中不需要隐藏的sheet表;最后点击“确定”按钮即可。

25 Nov 2024
使用 PHP 在单独的 Excel 单元格中检索 MySQL 数据您的原始 PHP 脚本将所有文本值合并到一个 Excel 单元格中,存在冲突...


Hot Tools
