Skip to content
Latestv1.0.63

Table - Print ​

Through the built-in printing function, table data can be printed in a beautiful format, supporting custom titles, headers/footers, specific columns, pagination, printing multiple tables, and custom templates.

The most basic printing method, using the component instance method print() to generate a print preview in a new window.

Print Table

Custom the top and bottom content of the printed page via headerHtml and footerHtml.

Custom Header and Footer

Advanced Print ​

Multiple options can be configured such as Title, No., Time, Count, and Paper orientation.

Advanced Print

Specify Columns ​

Control the columns to be printed by checking/unchecking.

Specify Columns

Custom Header/Title ​

Build complex company headers, including company name, report name, and report number via headerHtml.

Custom Header/Title

Add signature lines such as created by, approved by, and date via footerHtml.

Custom Footer

Set Margins ​

Configure the top, right, bottom, and left margins of the printed page via margin.

Set Margins

Paginate the Table for Printing ​

Set the maximum number of rows per page via pageSize for automatic pagination. Use showPageNumber to display page numbers.

Pagination Print

Print multiple tables with different data at once using the printMultiple method, with each table automatically paginated.

Print Multiple Tables

The printTemplate method allows for the printing of completely custom HTML templates, such as shipping orders, invoices, reports, etc.

Print Shipping Order

API ​

PropertyDescriptionTypeDefault
titlePrint titlestring—
showIndexWhether to show the index (No.) columnbooleanfalse
indexTitleIndex column titlestring'No.'
columnsSpecify columns to print (prop array)string[]All visible columns
excludeColumnsExclude columnsstring[]—
dataCustom print dataRecord<string, unknown>[]Current data
formatCellFormat cell content(value, column, row) => string—
headerHtmlCustom header HTMLstring—
footerHtmlCustom footer HTMLstring—
marginPage margins{ top?, right?, bottom?, left? }10mm
orientationPage orientation'portrait' | 'landscape''portrait'
showTimeWhether to show print timebooleantrue
showCountWhether to show record countbooleantrue
columnTitlesCustom Column TitlesRecord<string, string>—
pageSizeMaximum rows per pagenumber—
showPageNumberWhether to show page numbersbooleanfalse
tableStyleCustom table stylestring—
extraCssExtra CSSstring—
autoPrintAutomatically pop up print dialogbooleanfalse
beforePrintCallback before print() => boolean—
afterPrintCallback after print() => void—

printMultiple(tables, config?) Method ​

Print multiple tables at once; each table is automatically paginated.

ParameterDescriptionType
tablesTable configuration arrayArray<{ title?, data, columns?, config? }>
configGlobal configurationSame as print(config)

printTemplate(html, config?) Method ​

Print a completely custom HTML template.

ParameterDescriptionType
htmlCustom HTML contentstring
configPrint configurationSame as print(config)

Notes ​

  • Printing depends on window.open(); ensure the browser allows popups.
  • Print styles are implemented via inline CSS to ensure correct rendering in the print preview.
  • Use the @page CSS rule to control page orientation and margins.
  • Pagination is implemented using page-break-after: always.
  • autoPrint: true automatically pops up the print dialog after the window opens.

Released under the MIT License.