1
ブートストラップ(shieldUI-all.min.js)を使用してhtmlテーブルのデータをpdfにエクスポートしようとしています。私は完了しましたが、私はキャプション付きのPDFフォーマットが必要です。つまり、テーブルの上部に向かっています。私はそれをする方法を知らない。ブートストラップを使用してhtmlテーブルをエクスポートするときにキャプションを含める方法
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オプションでこれを達成するための簡単な方法がないと信じて
yah私は見ましたが、エクスポートオプションを正確に使用する方法と、必要なjsファイルが何であるかわかりません。 – mul1103
次のサンプルを開始点として使用できます。 http://demos.shieldui.com/web/grid-general/export-to-pdf また、役に立つトピックもあります。 http:// www .shieldui.com/documentation/grid/javascript/getting.started これは、含めるのに必要なリソースを詳述しています。 –
私はphp codeigniterを使用しています。だから、シールドUIでそれを行うことは可能ですか? – mul1103