虽然可以打开看到里面的内容,但是给人的感觉就是很不爽,于是分析下代码找到了解决方法
找到文件public/assets/libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.js
大概在97行
把代码
require(['tableexport'], function () {
that.$el.tableExport($.extend({}, that.options.exportOptions, {
type: type,
escape: false
}));
});
替换成
if(type == 'excel'){
require(['tableexport','/assets/libs/tableExport.jquery.plugin/libs/js-xlsx/xlsx.core.min.js'], function () {
that.$el.tableExport($.extend({}, that.options.exportOptions, {
type:'excel',
mso: { fileFormat: 'xlsx' }
}));
});
}else{
require(['tableexport'], function () {
that.$el.tableExport($.extend({}, that.options.exportOptions, {
type: type,
escape: false
}));
});
}
这里需要引入文件
/assets/libs/tableExport.jquery.plugin/libs/js-xlsx/xlsx.core.min.js
所以可以去https://github.com/hhurz/tableExport.jquery.plugin下载引入
后端引入的是压缩包文件,所以这里需要把文件public/assets/libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.js压缩成public/assets/libs/bootstrap-table/dist/extensions/export/bootstrap-table-export.min.js文件
可以使用 PHP 内置的 fputcsv() 函数将 2 维数组写入 CSV 文件,同时设置文件编码为 UTF-8 以避免中文乱码。示例代码如下:// 创建一个包含中文的 2 维数组$data = a...
具体上代码:// 导入 public function import(){ $file = $this->request->request('file'); ...
// $val = $currentSheet->getCellByColumnAndRow($currentColumn, $currentRow)->getValue();// ...
在不进行特殊设置的情况下,phpExcel将读取的单元格信息保存在内存中,我们可以通过PHPExcel_Settings::setCacheStorageMethod()来设置不同的缓存方式,已达到降...