Exporting url to excel
Exporting url to excel
jorgelub12
Posts: 3Questions: 0Answers: 0
Hello, I’m tried to find a fix in google but nothing result. I sea that a lot of people had this issue too.
The problem is that I have in my table a row with a link like ‘<a href=‘link’>some<a>’ but when I export using default buttons to excel, the file doesn’t show an hyperlink, just a plaintext
This discussion has been closed.
Replies
Hello, someone have a solution for this ?
Unfortunately this is not a trivial task. It would require writing customized code to convert URL to something Excel will use. This is a simple example of customized code:
https://datatables.net/extensions/buttons/examples/html5/excelCellShading.html
Writing this code would require understand the Excel Open XML format:
http://officeopenxml.com/SScontentOverview.php
Then customizing the output to match the specification. Here is a tutorial on how to insert hyperlinks into Excel:
https://ankushbhatia.wordpress.com/2011/03/04/how-to-insert-a-hyperlink-in-excel-using-open-xml-sdk-2-0/
If you are able to get this working please post your results.
Kevin
You might want to consider generating the Excel at the back end using PHPExcel for example. I am currently getting started to build some reporting features for my application as well and I found it too cumbersome to do this with the data tables export functionality.
I am building the following functionality:
The user can ask for a report at the front end clicking on a data tables button. Then the reporting is being generated using Excel PHP etc. and the files are uploaded to my files table. One or two seconds later the user will see file icons at the front end in the data table. One click and the reports are downloaded.
Here is a solution for hyperlinks using PHP Excel: https://stackoverflow.com/questions/23100636/phpexcel-how-to-set-a-url
Thanks. I’m going to try phpexcel