export buttons with html formatted text

export buttons with html formatted text

CharleyCharley Posts: 66Questions: 17Answers: 0

https://jsfiddle.net/charleycartee/tgyodq8k/

html formatted text doesn't necessarily get handled very nicely. Any suggestions?

This question has accepted answers - jump to:

Answers

  • colincolin Posts: 15,112Questions: 1Answers: 2,583
    edited September 2018 Answer ✓

    Hi @Charley,

    I think when there's more complex cell data, such as HTML, you need to do that fine level of customisation yourself within the exportOptions or buttons.exportData(). Not a great answer, but hope that helps,

    Cheers,

    Colin

  • CharleyCharley Posts: 66Questions: 17Answers: 0
    edited September 2018

    So, to clarify, if I were to add a button with the following config

    {extend:'excelHtml5', exportOptions: {columns: ':visible'}, title: exportTitle, className:'btn-outline-info btn-default'}
    

    and I wanted to tweak the body format so that instead of just stripping html it handled it in a nicer way, I'd do something like

    {extend:'excelHtml5', exportOptions: {columns: ':visible', format:{body:bodyFormatFunction}}, title: exportTitle, className:'btn-outline-info btn-default'}
    
  • CharleyCharley Posts: 66Questions: 17Answers: 0

    I think what I'd like to do is run a function to preprocess specific tags (UL/OL/LI at a minimum, maybe others) and then perhaps run the default functionality... any hints where that default function is?

  • colincolin Posts: 15,112Questions: 1Answers: 2,583
    Answer ✓

    Hi @Charley,

    I believe you could do that in buttons.exportData() - check for the presence of those elements and reformat them before they get sent to the export.

    Cheers,

    Colin

This discussion has been closed.