TableTools - How to add additional information in to CSV files

TableTools - How to add additional information in to CSV files

kevinm2kkevinm2k Posts: 9Questions: 2Answers: 0

Hi,

I'm using table tools and have the option to export to CSV/Excel. However my client is asking for additional information to be passed to the file on export.

Exporting to PDF actually gives pMessage (I think thats what it is) which it includes at the top, is there anything I can use to put some information in to the CSV? Or any workaround or hack I can add to get it working? I don't really want have to write a custom csv wrapper.

Thanks

Kevni

Answers

  • allanallan Posts: 63,180Questions: 1Answers: 10,411 Site admin

    You could provide a custom fnClick method for your export button that basically does the same as the default button action but appends or prepends whatever text you want. I guess the only thing to watch out for is to not make the CSV file invalid.

    Allan

  • kevinm2kkevinm2k Posts: 9Questions: 2Answers: 0

    Can you give me an example on how to do this?

    Thanks

  • allanallan Posts: 63,180Questions: 1Answers: 10,411 Site admin
    "fnClick": function( nButton, oConfig, flash ) {
        this.fnSetText( flash, "My text\n\n"+this.fnGetTableData(oConfig) );
    }
    

    The fnClick documentation is here.

    Allan

  • kevinm2kkevinm2k Posts: 9Questions: 2Answers: 0

    Hi Allan,

    I was playing with this and managed to get it working... didn't realise how simple it was to be quite honest.

    Thanks for your help.

    Kevin

This discussion has been closed.