Note: You can refer to my other post where it would support different flavors like Excel, Pdf
Edit in plunker new
Note: For excel it does not allow "-" character. We have to use replace function
Note: For excel it does not allow "-" character. We have to use replace function
$scope.SelectedUsers.selected.Text.replace("– ", "-- ")
<!DOCTYPE html> <script src="https://rawgithub.com/eligrey/FileSaver.js/master/FileSaver.js" type="text/javascript"></script> <html ng-app="myApp"> <head> <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <script src="https://rawgithub.com/eligrey/FileSaver.js/master/FileSaver.js"type="text/javascript"></script> <meta charset="utf-8" /> </head> <body> <div ng-controller="myCtrl"> <button ng-click="exportData()" ng-show="(items|filter:{selected: true}).length">Export</button> <br /> <table width="100%"> <thead> <tr> <th></th> <th>Name</th> <th>Date</th> <th>Terms</th> </tr> </thead> <tbody> <tr ng-repeat="item in items"> <td><input type="checkbox" ng-model="item.selected" /></td> <td>{{item.Name}}</td> <td>{{item.Date}}</td> <td><span ng-repeat="term in item.Terms">{{term}}{{!$last?', ':''}}</span></td> </tr> </tbody> </table> <div id="exportable" style="display:none"> <table width="100%"> <thead> <tr> <th>Name</th> <th>Date</th> <th>Terms</th> </tr> </thead> <tbody> <tr ng-repeat="item in items|filter:{selected: true}"> <td>{{item.Name}}</td> <td>{{item.Date}}</td> <td><span ng-repeat="term in item.Terms">{{term}}{{!$last?', ':''}}</span></td> </tr> </tbody> </table> </div> </div> </body> </html> <script type="text/javascript"> var myAppModule = angular.module('myApp', []); myAppModule.controller('myCtrl', function ($scope) { $scope.exportData = function () { var blob = new Blob([document.getElementById('exportable').innerHTML], { type: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8" }); saveAs(blob, "Report.xls"); }; $scope.items = [{ "Name": "ANC101", "Date": "10/02/2014", "Terms": ["samsung", "nokia", "apple"] }, { "Name": "ABC102", "Date": "10/02/2014", "Terms": ["motrolla", "nokia", "iPhone"] }] }); </script>
Other approach
we need to filesaver.js file
ReplyDeleteyou are really a just right webmaster. The site loading speed is incredible. It seems that you are doing any unique trick. Moreover, The contents are masterpiece. you've performed a magnificent activity on this topic! yahoo email login
Positive site, where did u come up with the information on this posting?I have read a few of the articles on your website now, and I really like your style. Thanks a million and please keep up the effective work. seo
ReplyDeleteThanks a lot very much for the high quality and results-oriented help. I won’t think twice to endorse your blog post to anybody who wants and needs support about this area. We are providing AngularJS training in Velachery.
ReplyDeleteFor more details: AngularJs training in velachery
I just needed to record a speedy word to express profound gratitude to you for those magnificent tips and clues you are appearing on this site. We are providing AngularJs training in Velachery.
ReplyDeleteFor more details: AngularJs Training in Chennai
Literally, the best blog I have ever read. I feel bad, for not finding this blog sooner.
ReplyDeletemason soiza
Thanks for sharing this post.Keep sharing more like this.
ReplyDeleteGuest posting sites
Technology
Excellent post, it will be definitely helpful for many people. Keep posting more like this.
ReplyDeleteBest ccna Training in Chennai
ccna Training in Chennai
ccna course in Chennai
Angular 7 Training in Chennai
AngularJS Training in Chennai
Ethical Hacking Training in Chennai
CCNA course in Ambattur
CCNA course in T Nagar
CCNA course in OMR
Great blog, I was searching this for a while. Do post more like this.
ReplyDeleteAngularJS Training in Chennai
Angular 4 Training in Chennai
Angular 5 Training in Chennai
Angular Training in Chennai
ReactJS Training in Chennai
PHP course in Chennai
Web Designing Training in Chennai
AngularJS Training in Anna Nagar
AngularJS Training in Vadapalani
AngularJS Training in Thiruvanmiyur
Really a awesome blog for the freshers. Thanks for posting the information.
ReplyDeletebusiness card price in india
online paper bag printing india
desktop rental in chennai
macbook for rent in chennai
online company registration in india
company registration consultants in india
Great post. keep sharing such a worthy information
ReplyDeleteSoftware Testing Training in Chennai
Software Testing Course in Bangalore
Software Testing Training in Coimbatore
Software Testing Course in Madurai
Best Software Testing Institute in Bangalore
Software Testing Training in Bangalore
Software Testing Training Institute in Bangalore
Tally Course in Bangalore
This comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteGreat article. Thanks for sharing Such a worthy information....
ReplyDeleteSelenium Training in Chennai
Selenium Training in Bangalore
Selenium Training in Coimbatore
Best Selenium Training in Bangalore
Selenium Course in Bangalore
Selenium Training Institute in Bangalore
selenium training in marathahalli
Software Testing Course in Chennai
Hacking Course in Bangalore
ReplyDeleteThe strategy you have posted on this technology helped me to get into the next level and had lot of information in it. The angular js programming language is very popular which are most widely used.
Dot Net Training in Chennai | Dot Net Training in anna nagar | Dot Net Training in omr | Dot Net Training in porur | Dot Net Training in tambaram | Dot Net Training in velachery
Amazing blog,Really useful information to all, Keep sharing more useful updates.
ReplyDeletewhy use cloud computing
advantages of machine learning
advantages of devops
php vs asp net
javascript interview questions
javascript interview questions and answers
This is a comprehensive notion and well done. Keeps updating...!
ReplyDeleteReact JS Training in Chennai
Blue Prism Training in Bangalore
Blue Prism Training in Chennai
Blue Prism Online Training