multiple tables with pdf buttons
multiple tables with pdf buttons
monkeyboy
Posts: 60Questions: 19Answers: 0
I have 3 tables in bootstrap tabs, each with it's own editor (as child rows - due to length of table)
I have successfully added buttons to each table:
New
PDF, EXCEL, CSV, and Copy
PDF button does not function on 2nd and 3rd tables
Excel button produces corrupt xslx file
Any ideas?
data table declaration
buttons: [
{ extend: "create", editor: editor2},
"copyHtml5",
"excelHtml5",
"csvHtml5",
"pdfHtml5"
]
Editors are editor, editor2, and editor3 to keep objects seperated
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Excel "repair" comment:
Excel completed file level validation and repair. Some parts of this workbook may have been repaired or discarded.
Replaced Part: /xl/worksheets/sheet1.xml part with XML error. The name in the end tag of the element must match the element type in the start tag. Line 1, column 39766.
Can you link to the page showing the issue so I can debug and resolve it please. Also, if you aren't already using the latest version of Buttons (1.1.0 at the moment), please update to that as it corrects a number of issues related to this.
Allan
Hi Allan,
Apologies on no link. MY server is not connected to the net, but This post is exactly what I am seeing with Buttons-1.1.0
http://datatables.net/forums/discussion/31793/datatable-data-not-getting-written-to-excel-file#latest
Linking is impossible, as my server has no external connection, and posting a snippet won't work, due to being embedded in a framework (Joomla)
Joomla is not the issue here, it is merely a matter of getting the JS script included into the page header.
(I will post a tutorial on this, as soon as I get my editor page fully functional)
Are you able to use JSFiddle, CodePen, http://live.datatables.net or similar to create a test case. The error you are seeing means that there is some data in the table that the export is not correctly handling while building the XML. I would need a test case showing what that data is so I can fix it.
Allan
Hi Allan,
I am commenting on this thread as monkeyboy has shared my post here as well and i didn't see any reply from you on my below post.
https://www.datatables.net/forums/discussion/31793/datatable-data-not-getting-written-to-excel-file#latest
I am not sure how to exactly recreate the same testcase on the link. But I can give you the details and you can check for yourself.
any of the <td> tags, you can try to put this data
You will see that the data is not getting depicted in the table just for this specific <td>
Now to make it visible on the table, I have used the below code in .js file
With the above code, i could see its getting written on the table.
Next, I try to click on Excel button, it asks me to save the file, but while opening it gives me the below error and nothing gets written to the xlsx.
"We have found a problem with some content in .xlsx". Do you want us to try and recover as much as we can"
I have faced some issue when i try to save it in pdf, but that is not a priority for me right now. I can share it in a separate post. But excel is a priority for me right now.
I am not sure if monkeyboy has same kind of data in his table. But for me this is certainly what it is. Could you please help?
Monkeyboy DOES have a very similar render statement.
I will try to remove it and see if it impacts the result.
May be a few days - big project at work wrapping up
Super - thanks. I'll try to create a local test case shortly and will post back.
Just to confirm, you've got the soap envelope in your HTML?
Allan
I do not have the soap envelop.... Can you point me to a link showing an example?
Can you modify this example with your data so it gives the error. Then I can investigate what the issue is.
Allan
HI Allan,
I have edited the example with the issue
http://live.datatables.net/disadoyu/1/edit
Now, you can see <> in the table, but when you click on Excel and try to open excel file, you will see the error i am talking about.
Thank you. It works with the nightly version (updated example).
Allan
Thanks a lot! Could you please let us know when this will be available in regular CDN? Or we have to use nightly version for some time.
I plan to do a release of Buttons before Christmas, so within the next few weeks.
Allan
Great! Thanks!
Allan,
As Christmas approaches, do you have a target release date for the new Buttons release?
Not yet. Unfortunately support work has been taking about 90% of my time recently so I've not actually been able to get any development done. As such the release may slip, but I hope not.
Allan
buttons 1.1.1-dev did not seem to fix the corrupt excel for me... Digging deeper
for a root cause
If you have a link to the page I will take a look. I was planning to release Buttons tomorrow, but won't if there is still a demonstrable issue that hasn't been fixed.
Allan
Unfortunately, The page cannot be posted publicly due to the nature of the information.
I have run various other tests last night, and cannot duplicate the error outside of my environment. I am certain I have a user error happening here.
You could try renaming the .xlsx file to .zip then pzip it. You'll find a sheet XML file in one of the directories. That will presumably contain invalid XML given the error you are seeing - we'd need to know what that error is (i.e. what character(s) are causing it to be invalid).
Allan
I will try that and let you know.....
Hi Allan,
Did you push the Buttons code to regular CDN?
Buttons 2.0.0 is the current release of Buttons. Due to the number of support requests I was unable to make the release before Christmas, and it is still a work in progress.
Allan