From 751be9c200c23e7722b00c497a63d048252ae2c3 Mon Sep 17 00:00:00 2001 From: isamu Date: Thu, 21 Dec 2023 09:30:04 +0900 Subject: [PATCH] Add table example with image cell. --- examples/tables.js | 56 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 55 insertions(+), 1 deletion(-) diff --git a/examples/tables.js b/examples/tables.js index c1a42e585..d961d8b4d 100644 --- a/examples/tables.js +++ b/examples/tables.js @@ -681,7 +681,61 @@ var docDefinition = { ], ], }, - } + }, + { text: 'Image on table', pageBreak: 'before', style: 'subheader' }, + { + style: 'tableExample', + color: '#444', + table: { + widths: [200, 'auto', 'auto'], + headerRows: 2, + // keepWithHeaderRows: 1, + body: [ + [ + { + text: 'Header with Colspan = 3', + style: 'tableHeader', + colSpan: 3, + borderColor: ['#ff00ff', '#00ffff', '#ff00ff', '#00ffff'], + alignment: 'center', + }, + {}, + {}, + ], + [ + { + text: 'Header 1', + style: 'tableHeader', + alignment: 'center', + }, + { + text: 'Header 2', + style: 'tableHeader', + alignment: 'center', + }, + { + text: 'Header 3', + style: 'tableHeader', + alignment: 'center', + }, + ], + [ + { + image: 'fonts/sampleImage.jpg', + cover: {width: 100, height: 100 }, + }, + { + image: 'fonts/sampleImage.jpg', + cover: {width: 100, height: 100 }, + }, + { + image: 'fonts/sampleImage.jpg', + cover: {width: 100, height: 100 }, + }, + ], + ], + }, + }, ], styles: { header: {