Premium plugin : Print - GBonnaire/jspreadsheet-plugins-and-editors GitHub Wiki

JSpreadsheet Plugin : Print

You can buy this plugin on Repo plugin Print Demo is available on demo Print

Dependencies

Options of plugin

Option name Description Type Default Value
allowPrint Allow print for page Boolean true
allowShortcut Allow shortcut CTRL+P for open popup of print Boolean true
autoprint start print automaticaly after preview. Set false for force preview before print Boolean true
header Show columns header on print Boolean true
index Show rows index on print Boolean true
orientation Defined orientation of page
  • auto : page orientation defined by printer
  • landscape : page orientation force to landscape
  • portrait : page orientation force to portrait
String auto
range Defined area range ArrayOfCoord[x1,y1,x2,y2] or String "A1:B5" null
rowBreaker Defined page breaker after number of rows Int|"auto" "auto"
style Defined styles CSS String|Function (blank)
stylesheet Defined url of style file .css String (blank)
title Title of page printed String (blank)
zoom Zoom of page printed (1 = 100%) Float 1

For translation

Option name Default Value
text_true Yes
text_false No
text_orientation Orientation
text_orientation_landscape Landscape
text_orientation_portrait Portrait
text_orientation_auto Printer settings
text_zoom Zoom
text_title Title of page
text_popup_title Print options
text_index Show index of rows
text_header Show header of columns
text_print_area Print area
text_print_selection Print selection
text_print_resultsearch Print results of search
text_print_all Print all rows of the sheet
text_print_area_defined Print area defined
text_print Print
text_printpreview Preview

Methods of plugin

Method Description Example
do(*optional* Object optionsPrint) → Void execute print with options, if optionsPrint is null, print with default options jspreadsheet.current.plugins.print.do({title:'test button print', index:false});
open() → Void Open popup print jspreadsheet.current.plugins.print.open();
preview(*optional* Object optionsPrint) → Void execute preview print with options, if optionsPrint is null, preview with default options jspreadsheet.current.plugins.print.preview({title:'test button print', index:false});
resetRange() → Void remove range print area jspreadsheet.current.plugins.print.resetRange();
setRange(Array|String range) → Void set range print area (by Coord [x1,y1,x2,y2] of A1:B10) jspreadsheet.current.plugins.print.setRange("A1:B10");
setStyle(String style) → Void set style of page printed jspreadsheet.current.plugins.print.setStyle(".jexcel tbody tr td.cellAlert {background-color: #f46e42!important;color: #ffffff;}");

Events

Event Description Arguments
onprint event dispatch after start print and preview onprint(ElementJExcel)

Get started

Header on page

<script src="https://jsuites.net/v4/jsuites.js"></script>
<script src="http://www.jspreadsheet.com/v9/jspreadsheet.js"></script>
<link rel="stylesheet" href="https://jsuites.net/v4/jsuites.css" type="text/css" />
<link rel="stylesheet" href="http://www.jspreadsheet.com/v9/jspreadsheet.css" type="text/css" />

<script src="/path/to/jss.print.js"></script>

Initialize plugin on JSpreadsheet

jspreadsheet(document.getElementById('spreadsheet'), {
	...
	plugins: [
      ...
      { name:'print', plugin:jss_print},
      ...  
    ],
    ...
});

Example

Header on page

<script src="https://jsuites.net/v4/jsuites.js"></script>
<script src="http://www.jspreadsheet.com/v9/jspreadsheet.js"></script>
<link rel="stylesheet" href="https://jsuites.net/v4/jsuites.css" type="text/css" />
<link rel="stylesheet" href="http://www.jspreadsheet.com/v9/jspreadsheet.css" type="text/css" />

<script src="/path/to/jexcel.print.js"></script>

Initialize plugin on JExcel

jspreadsheet(document.getElementById('spreadsheet'), {
	...
	plugins: [
      ...
   		 { name:'print', plugin:jss_print, options:{title:"test print", index:false, style:function(obj) { return obj.plugins.conditionalstyle.getCSS(); }} }, // For apply style of plugin conditional style
      ...  
    ],
    ...
});

Copyright and license

Copyright GBonnaire.fr and Code released under the commercial License. This plugin requiere license of Repo.gbonnaire.fr

⚠️ **GitHub.com Fallback** ⚠️