简体   繁体   English

我想使用angular js将使用分页的动态html表的数据导出到excel表中

[英]I want to export the data of a dynamic html table,where pagination has been used,into an excel sheet using angular js

I want to export the data of a dynamic paginated html table into an excel sheet using angular js.我想使用angular js将动态分页html表的数据导出到excel表中。 I have in google, but they all are working for static tables,not for the one I need.我在谷歌,但他们都在为静态表工作,而不是我需要的。 I have tried the below code:我试过下面的代码:

var app = angular.module('myapp', []);

app.controller('Mycn',  function($scope) {

   $scope.exportfunc = function(){
   var strCopy = document.getElementById("MyTable").innerHTML;
   window.clipboardData.setData("Text", strCopy);
   var objExcel = new ActiveXObject ("Excel.Application");
   objExcel.visible = true;

   var objWorkbook = objExcel.Workbooks.Add;
   var objWorksheet = objWorkbook.Worksheets(1);
   objWorksheet.Paste;
   }
});

its posible using它可能使用

const ExcelFile = ReactExport.ExcelFile const ExcelSheet = ReactExport.ExcelFile.ExcelSheet const ExcelFile = ReactExport.ExcelFile const ExcelSheet = ReactExport.ExcelFile.ExcelSheet

const title = 'Report Name' const columns = ['Account', 'Name'] const title = 'Report Name' const columns = ['Account', 'Name']

export class ComplaintExport extends Component { createData = () => { const { data, subtitle = 'Conversaciones' } = this.props export class ComplaintExport extends Component { createData = () => { const { data, subtitle = 'Conversaciones' } = this.props

 const dataSet = [{ columns: [title], data: [] }, { columns: [subtitle], data: [] }, { columns: columns, data: data }] return dataSet } render() { const dataSet = this.createData() return ( <ExcelFile element={ <Button variant="contained" color="primary"> Export All <Icon>attachment</Icon> </Button> } > <ExcelSheet dataSet={dataSet} name="Cons" /> </ExcelFile> ) }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM