multiple tables with pdf buttons

multiple tables with pdf buttons

monkeyboymonkeyboy 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

Answers

  • monkeyboymonkeyboy Posts: 60Questions: 19Answers: 0

    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.

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    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

  • monkeyboymonkeyboy Posts: 60Questions: 19Answers: 0

    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)

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    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

  • vbjoe13vbjoe13 Posts: 13Questions: 4Answers: 0
    edited December 2015

    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

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="test" xmlns:urn1="test"> <soapenv:Header>
    

    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

    render: function(data, type, full, meta){
                                       return $('<div/>').text(data).html();
                                   }
    

    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?

  • monkeyboymonkeyboy Posts: 60Questions: 19Answers: 0

    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

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    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

  • monkeyboymonkeyboy Posts: 60Questions: 19Answers: 0

    I do not have the soap envelop.... Can you point me to a link showing an example?

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Can you modify this example with your data so it gives the error. Then I can investigate what the issue is.

    Allan

  • vbjoe13vbjoe13 Posts: 13Questions: 4Answers: 0

    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.

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Thank you. It works with the nightly version (updated example).

    Allan

  • vbjoe13vbjoe13 Posts: 13Questions: 4Answers: 0

    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.

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin
    Answer ✓

    I plan to do a release of Buttons before Christmas, so within the next few weeks.

    Allan

  • vbjoe13vbjoe13 Posts: 13Questions: 4Answers: 0

    Great! Thanks!

  • monkeyboymonkeyboy Posts: 60Questions: 19Answers: 0

    Allan,

    As Christmas approaches, do you have a target release date for the new Buttons release?

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    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

  • monkeyboymonkeyboy Posts: 60Questions: 19Answers: 0

    buttons 1.1.1-dev did not seem to fix the corrupt excel for me... Digging deeper
    for a root cause

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    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

  • monkeyboymonkeyboy Posts: 60Questions: 19Answers: 0

    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.

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    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

  • monkeyboymonkeyboy Posts: 60Questions: 19Answers: 0

    I will try that and let you know.....

  • vbjoe13vbjoe13 Posts: 13Questions: 4Answers: 0

    Hi Allan,

    Did you push the Buttons code to regular CDN?

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    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

This discussion has been closed.