使用引导程序导出html表时,如何在pdf中包含标题



我正在尝试使用bootstrap(shieldUI-all.min.js)将html表数据导出为pdf。我完成了,但我需要在表顶部带有标题ie)的pdf格式。我不知道怎么做。

jQuery(function ($) {
            $("#export_supplier_pdf").click(function () {
        // parse the HTML table element having an id=exportTable
        var dataSource = shield.DataSource.create({
            data: "#table_supplier_master",
            schema: {
                type: "table",
                fields: {
                    CODE:  { type: String },
                    Name: { type: String },
                    ContactPerson: { type: String },
                }
            }
        });
        // when parsing is done, export the data to PDF
        dataSource.read().then(function (data) {
            var pdf = new shield.exp.PDFDocument({
                author: "GBLS",
                created: new Date()
            });
            pdf.addPage("a4", "portrait");
            pdf.table(
                50,
                50,
                data,
                [
                    { field: "CODE", title: "CODE", width: 200 },
                    { field: "Name", title: "Name", width: 200 },
                     { field: "ContactPerson", title: "ContactPerson", width: 200 }
                ],
                {
                    margins: {
                        top: 50,
                        left: 50
                    }
                }
            );
            pdf.saveAs({
                fileName: "Supplier_master"
            });
        });
    });
        });

或者以其他方式实现同样的目标???

我相信目前没有简单的方法可以通过PDF选项实现这一点:http://www.shieldui.com/documentation/grid/javascript/api/settings/exportOptions/pdf另一种选择是简单地将所需的数据添加到网格本身,以便将其导出到PDF文档中。

最新更新