角度数据表中excel导出中的标题无效

时间:2017-11-13 04:50:03

标签: angularjs export-to-excel angular-datatables

我正在使用角度数据表在前端应用程序中显示我的数据。我想以excel和pdf导出数据表。在pdf中,标题工作正常,但在excel中,titile没有显示出来。

这是我的代码。标题将来自api。在pdf中,它按预期工作,但在excel导出中没有。

vm.dtOptions = DTOptionsBuilder.fromFnPromise(function() {
        var defer = $q.defer();
        defer.resolve(records);
        return defer.promise;
    })
    .withDOM('<"mb15"B>lfrtip')
    .withPaginationType('full_numbers').withBootstrap().withLanguage({
        'sSearch': '<b>Filter: </b>',
        'sSearchPlaceholder': 'Search...'
    }).withOption('scrollX', '100%')
    .withButtons([
        {
            extend: 'excel',
            text: 'Excel',
            exportOptions: {
                columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] //we don't want the first 'control' column
            },
            className: 'btn btn-info mr5',
            filename: 'bill_' + now,
            title: all_billings[0].billing_header

        },
        {
            extend: 'pdf',
            text: 'PDF',
            exportOptions: {
                columns: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11] //we don't want the first 'control' column
            },
            className: 'btn btn-info buttons-csv buttons-html5',
            filename: 'bill_' + now,
            orientation: 'landscape',
            title: all_billings[0].billing_header
        }
    ]);

0 个答案:

没有答案