datatable excel export. i can't change cell text

datatable excel export. i can't change cell text

valtandersvaltanders Posts: 4Questions: 1Answers: 0

Hello, im using datatables 1.10.18 along with the buttons plugin.
in the customize callback, i need to change some footer text on the export: here the code:

for (var col in cols) {
    var media = $('row:last c[r^=' + cols[col] + ']', sheet).text().replace(/\./g, '');
    console.log(media);
    $('row:last c[r^=' + cols[col] + ']', sheet).text(media);
}

the var media is populated correctly and its show in the console, but with the next line, set it in blank. the line that i want to change is a footer on datatable

This question has an accepted answers - jump to answer

Answers

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

    Hi @valtanders ,

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. 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

  • valtandersvaltanders Posts: 4Questions: 1Answers: 0

    Hi Colin! thanks for your quick answer.
    Here is the live code, i had a few problems with the libraries (buttons and jsZIP). and hope you can help me with that.

    http://live.datatables.net/valafohi/1/edit

  • valtandersvaltanders Posts: 4Questions: 1Answers: 0

    Colin, so sorry, i had a typo error.

    here the test case : http://live.datatables.net/valafohi/1/edit

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

    Hi @valtanders ,

    Thanks for the test case, that helped. I wouldn't use the customize function for that, though I'm not sure why it doesn't work. The best bet is to use exportOptions as in this modified example.

    Hope that helps,

    Cheers,

    Colin

  • valtandersvaltanders Posts: 4Questions: 1Answers: 0

    @colin, thank you so much! work like a charm.

    Cheers,
    Bruno.

This discussion has been closed.