Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/76.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用reactjs/javascript在一个excel工作表中导出两个表_Javascript_Html_Reactjs_Xls - Fatal编程技术网

如何使用reactjs/javascript在一个excel工作表中导出两个表

如何使用reactjs/javascript在一个excel工作表中导出两个表,javascript,html,reactjs,xls,Javascript,Html,Reactjs,Xls,我正在尝试使用reactjs在一个excel工作表中导出两个表,有人能建议我使用任何库或如何实现这一点吗 函数toExcel(){ 如果(“窗口中的ActiveXObject”){ 警报(“这是Internet Explorer!”); }否则{ var cache={}; this.tmpl=函数tmpl(str,data){ var fn=!/\W/.test(str)?cache[str]=cache[str]| | tmpl(document.getElementById(str.inn

我正在尝试使用reactjs在一个excel工作表中导出两个表,有人能建议我使用任何库或如何实现这一点吗

函数toExcel(){
如果(“窗口中的ActiveXObject”){
警报(“这是Internet Explorer!”);
}否则{
var cache={};
this.tmpl=函数tmpl(str,data){
var fn=!/\W/.test(str)?cache[str]=cache[str]| | tmpl(document.getElementById(str.innerHTML):
新功能(“obj”,
var p=[],print=function(){p.push.apply(p,参数);}+
“与(obj){p.push('”+
str.replace(/[\r\t\n]/g,“”)
.split(“{”).join(“\t”)
.replace(/((^\t]*)”/g,“$1\r”)
.replace(/\t=(.*?}}}/g,“,$1,”)
.split(“\t”).join(“);”)
.split(“}”).join(“p.push(”)
.split(“\r”).join(“\\'”+”);}返回p.join(“”);
返回数据?fn(数据):fn;
};
var tableToExcel=(函数(){
var uri='data:application/vnd.ms excel;base64',
template='{for(var i=0;i
function-toExcel(){
如果(“窗口中的ActiveXObject”){
警报(“这是Internet Explorer!”);
}否则{
var cache={};
this.tmpl=函数tmpl(str,data){
var fn=!/\W/.test(str)?cache[str]=cache[str]| | tmpl(document.getElementById(str.innerHTML):
新功能(“obj”,
var p=[],print=function(){p.push.apply(p,参数);}+
“与(obj){p.push('”+
str.replace(/[\r\t\n]/g,“”)
.split(“{”).join(“\t”)
.replace(/((^\t]*)”/g,“$1\r”)
.replace(/\t=(.*?}}}/g,“,$1,”)
.split(“\t”).join(“);”)
.split(“}”).join(“p.push(”)
.split(“\r”).join(“\\'”+”);}返回p.join(“”);
返回数据?fn(数据):fn;
};
var tableToExcel=(函数(){
var uri='data:application/vnd.ms excel;base64',

template={for(var i=0;i您可以使用
react html table to excel
使用id导出文件,然后在reactoExcel上实现相同的id

npm i react html table to excel
或者如果您使用warn
warn,请将react html table添加到excel

 <table id="table-to-xls" >

.....

</table>

 <ReactToExcel
   className="btn "
   table="table-to-xls"
   filename="Name of file"
   sheet="sheet 1"
   buttonText={t("export_report")}
 />

.....

您可以使用
react html table to excel
使用id导出文件,然后在reactoExcel上实现相同的id

npm i react html table to excel
或者如果您使用warn
warn,请将react html table添加到excel

 <table id="table-to-xls" >

.....

</table>

 <ReactToExcel
   className="btn "
   table="table-to-xls"
   filename="Name of file"
   sheet="sheet 1"
   buttonText={t("export_report")}
 />

.....