export excel;can i set column width? thanks!!!

export excel;can i set column width? thanks!!!

784519336784519336 Posts: 1Questions: 1Answers: 0
edited November 2020 in Free community support
{
                extend: 'excelHtml5',
                text: '导出EXCEL',
                title: tableData.printTitle,
                //exportOptions: {
                //    columns: tableData.printColumnsData
                //},
                //customize: function (xlsx) {    
                //    var sheet = xlsx.xl.worksheets['sheet1.xml'];

                //    //$('col ', sheet).attr('s', '25');
                //    $('col c[c*="1"]', sheet).attr('s', '9');
                //}
                exportOptions: { //选项参见:https://datatables.net/reference/api/buttons.exportData()
                    columns: tableData.printColumnsData,
                    format: { // format有三个子标签,header,body和foot

                        body: function (data, row, column, node) { //操作需要导出excel的数据格式

                            return data.toString()+' ';

                        }

                    },
                    

                }

            },

Edited by Colin - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

Answers

  • colincolin Posts: 15,237Questions: 1Answers: 2,599

    This thread should help, it's asking the same thing.

    Cheers,

    Colin

This discussion has been closed.