FooKelvin Posted September 11, 2015 Share Posted September 11, 2015 Hi Guys, I am using this plugin to export my table to excel file. But anyone know how to have custom name for the excel file? If possible the excel file name should follow the web html title. <title>Name</title> Link: Export to Excel Plug in Quote Link to comment https://forums.phpfreaks.com/topic/298129-jquery-export-to-excel/ Share on other sites More sharing options...
.josh Posted September 12, 2015 Share Posted September 12, 2015 Quick glance at the doc link you provided, I would say you just need to set the name config property to document.title Example using step #3 in doc: $("button").click(function(){ $("#table2excel").table2excel({ // exclude CSS class exclude: ".noExl", name: document.title }); }); Quote Link to comment https://forums.phpfreaks.com/topic/298129-jquery-export-to-excel/#findComment-1520737 Share on other sites More sharing options...
FooKelvin Posted September 14, 2015 Author Share Posted September 14, 2015 Quick glance at the doc link you provided, I would say you just need to set the name config property to document.title Example using step #3 in doc: $("button").click(function(){ $("#table2excel").table2excel({ // exclude CSS class exclude: ".noExl", name: document.title }); }); Hi Josh, The name: is for excel sheet name. I would like to change the file name, for example myname.xls Thank You Quote Link to comment https://forums.phpfreaks.com/topic/298129-jquery-export-to-excel/#findComment-1520811 Share on other sites More sharing options...
Ch0cu3r Posted September 14, 2015 Share Posted September 14, 2015 Try using filename: $("button").click(function(){ $("#table2excel").table2excel({ // exclude CSS class exclude: ".noExl", name: document.title, filename: "myFileName" }); }); Quote Link to comment https://forums.phpfreaks.com/topic/298129-jquery-export-to-excel/#findComment-1520821 Share on other sites More sharing options...
Psycho Posted September 14, 2015 Share Posted September 14, 2015 Hi Josh, The name: is for excel sheet name. I would like to change the file name, for example myname.xls Thank You interesting, since the example on the page you linked seems to highly infer that the 'name' is the document name $("button").click(function(){ $("#table2excel").table2excel({ // exclude CSS class exclude: ".noExl", name: "Excel Document Name" }); }); Quote Link to comment https://forums.phpfreaks.com/topic/298129-jquery-export-to-excel/#findComment-1520829 Share on other sites More sharing options...
FooKelvin Posted September 15, 2015 Author Share Posted September 15, 2015 Try using filename: $("button").click(function(){ $("#table2excel").table2excel({ // exclude CSS class exclude: ".noExl", name: document.title, filename: "myFileName" }); }); Still the same problem, the file name auto change to download.xls. Help~~~ Quote Link to comment https://forums.phpfreaks.com/topic/298129-jquery-export-to-excel/#findComment-1520877 Share on other sites More sharing options...
Ch0cu3r Posted September 15, 2015 Share Posted September 15, 2015 That worked for me using the demo code supplied in the download. I did have to do Ctrl+F5 after changing/applying filename: in the code though. Quote Link to comment https://forums.phpfreaks.com/topic/298129-jquery-export-to-excel/#findComment-1520881 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.