excelHtml5 and euro currency conversion

excelHtml5 and euro currency conversion

BastiaanBastiaan Posts: 2Questions: 1Answers: 0
edited October 2018 in Free community support

Hello,

I'm struggeling to export a table with euro currency values to Excel. The cells are exported as inlineStr and not as number. I'm able to convert the cell to '59', which stands for Euro currency but the cell type doensnt change to number type.

My questions:
- Should I add some kind of formatting to the html table td so excelHtml5 knows how what type of value is in the cell?
- If not, how can I change the inlineStr to number?

    customize: function( xlsx ) {
        var sheet = xlsx.xl.worksheets['sheet1.xml'];
        var twoDecPlacesCols = ['C', 'D'];           
        for ( i=0; i < twoDecPlacesCols.length; i++ ) {
            $('row c[r^='+twoDecPlacesCols[i]+']', sheet).attr( 's', '59' );
        }
        console.log(sheet);
    } 

Many thanks in advance!
Bastiaan

Answers

  • allanallan Posts: 61,435Questions: 1Answers: 10,049 Site admin

    It should actually work with the latest version of Buttons.

    Can you link to a test case showing the issue please?

    Allan

  • BastiaanBastiaan Posts: 2Questions: 1Answers: 0
    edited October 2018

    I have tried the new Buttons version but get an error:

    buttons.html5.js:51 Uncaught TypeError: Cannot set property 'pdfMake' of undefined
      at buttons.html5.js:51
      at buttons.html5.js:36
      at buttons.html5.js:38
    

    I downloaded the buttons file locally and generated a new datatables with buttons exluded:

    <script type="text/javascript" src="https://cdn.datatables.net/v/dt/dt-1.10.18/datatables.min.js"></script>
    <script type="text/javascript" src="assets/plugins/datatables/buttons.html5.js"></script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/pdfmake.min.js"></script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/vfs_fonts.js"></script>
    
This discussion has been closed.