How can I center the columns in the PDF?

How can I center the columns in the PDF?

otavio_laskosk_pcotavio_laskosk_pc Posts: 21Questions: 6Answers: 0
edited May 2018 in Free community support

I can't centralize the columns:

I've already put the command "alignment: 'center'" like this:

            exportOptions: {

                columns: [ 0, 1, 2, 3, 4, 5 ],
                                alignment: 'right',

            }

but nothing change.

Anyone know hot to solve it?

Answers

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

    Hi again,

    That same thread, shows how to center the header - you can slip that same line ('alignment: 'center') into the table body sections.

    Cheers,

    Colin

  • otavio_laskosk_pcotavio_laskosk_pc Posts: 21Questions: 6Answers: 0

    Hi Colin,

    Thank you by your reply,

    According the tutorial you've passed, I added the command doc.defaultStyle.alignment = 'center' in the function customize: function(doc).

    but it hasn't worked.

    I changed the alignment: 'right' to alignment: 'center' too and nothing change.

  • allanallan Posts: 61,665Questions: 1Answers: 10,096 Site admin

    You probably need to modify the styles.tableHeader.alignment property for the header cells, and similar for the other cells. See the pdfmake documentation for full details.

        styles: {
            tableHeader: {
                alignment: 'center'
            },
    

    Allan

  • otavio_laskosk_pcotavio_laskosk_pc Posts: 21Questions: 6Answers: 0

    Hi Allan,

    Thank you by your reply,

    I'm using the extend: 'pdfHtml5'

    I put this command in the function customize: function ( doc )?

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

    Take a look at the example here, it's using that thread to center the text.

    Cheers,

    Colin

This discussion has been closed.