Excel export : We found a problem with some content in '.xlsx'. Do you want us to try to recover

Excel export : We found a problem with some content in '.xlsx'. Do you want us to try to recover

ManiPSManiPS Posts: 28Questions: 12Answers: 0

When i open the exported file, I get the below error
" We found a problem with some content in 'filename.xlsx'. Do you want us to try to recover as much as we can?"

This is how i am using datatable

<script src="https://cdn.datatables.net/buttons/1.5.1/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.5.1/js/buttons.flash.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/vfs_fonts.js"></script>
<script src="https://nightly.datatables.net/buttons/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/1.5.1/js/buttons.print.min.js"></script>

"buttons": [
{
extend: 'excelHtml5',
title: "test",
filename: "testFile",
"createEmptyCells" : true,
sheetName: 'sheetName',
messageTop: "message",
customize: function( xlsx ) {
//my code
}
}
]

How to get rid of it? Please help me on this

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,663Questions: 1Answers: 10,095 Site admin
    Answer ✓

    Try removing this part:

    //my code

    Then does it work? If so, then its your customisation code that is causing the issue :).

    Allan

  • ManiPSManiPS Posts: 28Questions: 12Answers: 0

    Yes. It works fine by removing //my code.
    I will have a look at my customization code

  • uol_somuol_som Posts: 3Questions: 0Answers: 0

    I'm having a similar problem and at first I thought it was my custom code. However I get the same error when using the example page: https://datatables.net/extensions/buttons/examples/html5/simple.html

    I've attached a screenshot -** this only happens in Internet Explorer **(11 in my case, I can't test it in others).

    Hope you can help!

  • uol_somuol_som Posts: 3Questions: 0Answers: 0

    If it's any help, the problem seems to have occurred since buttons version 1.5.1 and 1.5.2 because if I use 1.5.1 it works fine.

  • allanallan Posts: 61,663Questions: 1Answers: 10,095 Site admin

    Yes, I'm afraid this is an IE11 / Buttons 1.5.2 bug. It is tracked here.

    Allan

  • uol_somuol_som Posts: 3Questions: 0Answers: 0

    Ah no problem - thanks for the reply.

  • joshie373joshie373 Posts: 1Questions: 0Answers: 0

    @allan, fix does not work for IE, still getting error
    see details:

    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. A qualified name cannot contain multiple colons. Line 1, column 922.

  • allanallan Posts: 61,663Questions: 1Answers: 10,095 Site admin

    @joshie373 - Are you using the nightly version of the Buttons HTML5 export? There is discussion about the fix in the nightly in the thread I linked to above.

    Allan

  • jojoshuajojoshua Posts: 5Questions: 1Answers: 0

    I am experiencing this as well in IE11. Here are my version dependencies

    "jquery": "3.3.1",
    "datatables.net": "1.10.19",
    "datatables.net-bs": "1.10.19",
    "datatables.net-buttons": "1.5.3",
    "datatables.net-buttons-bs": "1.5.3",
    "jszip": "3.1.5",

    Do I need to fallback to an earlier version of buttons to make the export to excel work?

  • kthorngrenkthorngren Posts: 20,275Questions: 26Answers: 4,765

    As per this thread I don't believe Buttons 1.5.3 has been released yet. At least I don't see it on the Download Builder page.
    https://datatables.net/forums/discussion/comment/137983/#Comment_137983

    As mentioned above and in the thread I posted you should try the nightly version.

    Kevin

  • jojoshuajojoshua Posts: 5Questions: 1Answers: 0

    Well...that's what I pulled in from npm. Says it was released 3 months ago.

    https://www.npmjs.com/package/datatables.net-buttons

  • kthorngrenkthorngren Posts: 20,275Questions: 26Answers: 4,765

    Sounds like there was a packaging issue causing the Datatable versions to show one version higher than they are:
    https://datatables.net/forums/discussion/comment/138755/#Comment_138755

    So, it seems you are still using Buttons 1.5.2 which has the issue you are asking about.

    Kevin

  • jojoshuajojoshua Posts: 5Questions: 1Answers: 0

    Oh that is odd but makes sense. Thanks for the info.

  • allanallan Posts: 61,663Questions: 1Answers: 10,095 Site admin

    Hah - yes. I've gone and confused myself with this. Buttons 1.5.4 is the one which will carry this fix. Working on wrapping stuff up for that at the moment.

    Allan

  • maquejpmaquejp Posts: 2Questions: 0Answers: 0

    Any idea when it will be available?

  • allanallan Posts: 61,663Questions: 1Answers: 10,095 Site admin

    Soon :)

  • maquejpmaquejp Posts: 2Questions: 0Answers: 0

    :)

  • RabelleRabelle Posts: 1Questions: 0Answers: 0

    I am using Buttons 1.5.4 (according to CDN) and the problem is not resolved. I have looked at the “nightly version”, but I’m not sure whether to swap out the datatables.buttons.js or the exportFlash(?).

    I have customized (hacked) the buttons and the colvis to show checkmarks on the visible columns so downloading a whole new build is not ideal.

    I’m not really a javascript gurú- more of a full-stack hacker. But I am on a timeline - and introducing Datatables to upper mgmt - and it would really nice if it would work in their favorite browser :-)

    Any advice would be appreciated!

  • rimshot609rimshot609 Posts: 9Questions: 6Answers: 0

    Has there been a fix for this yet? Thanks.

  • colincolin Posts: 15,142Questions: 1Answers: 2,586

    Hi @rimshot609 ,

    This was addressed in the 1.5.4 release, which is out now, Are you still seeing the problem? If so, could you please link to a test case. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.

    Cheers,

    Colin

  • KenKenneyKenKenney Posts: 1Questions: 0Answers: 0

    Was having the same issue...1.5.4 fixed it for me!
    Thanks all

This discussion has been closed.