In Export (pdf,excel) of tables using datatable how to include HTML in the exported File as in the e

In Export (pdf,excel) of tables using datatable how to include HTML in the exported File as in the e

snehasahusnehasahu Posts: 4Questions: 1Answers: 0

In exported file html should not strip and the html (link link, font size etc). retain in the file

Answers

  • colincolin Posts: 12,613Questions: 0Answers: 2,154
    edited August 17

    Buttons will strip HTML from the export by default. You can stop it doing that using the stripHtml option of the buttons.exportData() method (which for the pdf button you can control using the exportOptions parameter).

    Allan

  • snehasahusnehasahu Posts: 4Questions: 1Answers: 0

    On setting stripHtml = FALSE in exportOption. All the HTML are coming in the exported PDF but not working. Only the whole text with tags are coming.
    Please find the attached PDF screenshot for example

  • colincolin Posts: 12,613Questions: 0Answers: 2,154

    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

  • snehasahusnehasahu Posts: 4Questions: 1Answers: 0
    edited August 19

    live.datatables.net/turuxegi/3/edit

    Please refer to the example I did on live datatable.

    On setting stripHtml = FALSE in exportOption. All the HTML are coming in the exported PDF but not working. Only the whole text with tags are coming.

    I want the exported PDF should be the same as it is coming in the table. It should have all the link and styling.

  • colincolin Posts: 12,613Questions: 0Answers: 2,154

    Ah, yep, thanks for the example, that helps. Unfortunately there's no quick answer, this thread discusses the same topic with some code at the end that you'll need to add to preserve those links,

    Colin

  • snehasahusnehasahu Posts: 4Questions: 1Answers: 0

    My requirement includes table inside the datatable for a column. how to preserve that?

  • colincolin Posts: 12,613Questions: 0Answers: 2,154

    Again, you would need to modify the code in the same way as the example in the thread I posted,

    Colin

Sign In or Register to comment.