AngularJS: Export html table to pdf, excel and doc format

AngularJS is an awesome javascript framework for front-end development. As a newbie, you will find it simple to use but it becomes increasingly difficult when using it for an actual project.

I recently needed to create a function to export html table to other formats with angularJS and it became immediately difficult to do. A google search and stack-overflow didn’t show me how to go about implementing the functionality.

After a couple of hours fighting with angularJS directives i figured how to implement the functionality with the help of a jQuery module.

Here is the tutorial if you ever need to do something similar or interested in learning how to do it before your next angularJS project

7 Likes

It’s really awesome to see people documenting their solutions for problems.

If you use browserify, you could use this npm package ‘comma-separated-values’ to generate downloadable excel sheets from a data structure.

Just another way to solve this issue :smile:

2 Likes

Hi. Great work on exporting HTML tables to different formats. But when I try to export the same in Internet explorer its not working. It just opens in new blank tab. Any suggestions will be helpful.

I made a directive to export JSON to CSV. I’m sure it can be extended from here. If it’s useful to anyone https://github.com/devcenter-square/angular-export

hi FatherMerry,
nice to see you directive, i need to customize that like , i have image and audio in mt HTML table, but when we export to CSV, i need to customize the image and audio field instead displaying the image in CSV