News in version
TreeGrid Gantt chart SpreadSheet Examples Documentation Download Development Licensing Prices References Contacts Buy Try it free
Documentation
Search in documentation
TreeGrid versions compatibility

Changes log (txt file) Using custom CSS from 13.3 to 14.0 Upgrading from 9.3 to 10.0 Upgrading from 5.9 to 6.0

Using in JavaScript frameworks

Angular Ember Express React Svelte Vue Other frameworks NodeJS server SalesForce LWC

Creating grid

Simple examples Basic information Creating grid Deleting grid Reloading grid Rendering grid Accessing grid by API

Data & communication
Data communication with server

Communication types AJAX communication AJAX SOAP envelope Submit communication Directly included data Data from JavaScript Cross domain / local load by JSONP Sessions (AJAX) Server response (AJAX) Synchronous communication (AJAX) Caching (AJAX) API (AJAX)

Download data

Settings for data download Layout XML structure Data XML structure

Upload data

Settings for data upload API for upload XML structure sent to server

Changing data from server

XML structure of download changes XML structure of request for a cell Synchronizing data with server

Input / output data formats

Complete list of tags Internal XML format Short XML format Extra short XML format DTD XML format JSON format

Cells
Cell basics

Cell type Cell format Dynamic format Dynamic type Cell value Reading / writing attributes by API Cell HTML Cell default Range or more values in one cell Cell with link URL Cell hint Cell tooltip / title Cell popup menu

Cell editing and changing values

Cell editability Dynamic editing Locking Defaults list Suggest list (auto complete) Tags input Changing cell value Mass cell change Clearing cells Editing cells Controlling <input> tag by JavaScript Input validation and restrictions Side checkbox Cell selecting

Calculations - cell formulas

Basics Formulas Mathematical functions Aggregate functions Special functions for actions Custom functions

Calculations - editable cell formulas

Basics Suggest list (auto complete) Defined names Actions for choosing cells Conditional functions Lookup functions Cell reference functions Logical functions Informational functions Mathematical functions Trigonometry functions Rounding numbers Number conversions String functions Date functions Summary functions Custom functions

Cell side buttons

Introduction Right side Button Left side Icon

Cell spanning

Column span Row span Dynamic spanning

Cell style and color

Basic grid style Sizing and scaling - responsive design Dynamic cell style attributes Cell CSS class Cell background color Dynamic cell border Cell HTML style Row color alteration Cell mouse cursor

Editable cell images

Insert image Edit image

Cell types
Automatic type - Auto String - Text, Lines & Pass
Number - Int & Float

Format Localization

Date and time - Date

Format Calendar component Dates dialog Localization

List & combo - Enum & Radio

Introduction Definition Related lists Enum specific Radio specific

Checkbox - Bool
Action button - Button

Introduction Basic clickable button Switch button Radio / tab button Menu button Combo switch button Combo radio / tab button Special Space rows with buttons

Panel with more buttons - Panel

Definition Standard fast panel Custom panel

HTML and special types

Html type EHtml type (editable) Icon type Abs type List type Editable Link type Editable Img type DropCols type Upload File type

Columns

Column basics Column index Column visibility Column visibility menu Column selecting Column tree Auto column tree Column position and moving Column adding and copying Column deleting Column width Column API

Rows
Row basics

Rows by functionality Rows by position Row name Row id Row index

Default rows

Description Example of default rows Example of changing default row Attributes

Row tree

Tree attributes Actions & API for expand / collapse

Row identification

Setting row id attribute Row id attribute in tree Row id created from cell values API for row ids

Row visibility
Row adding and copying

Five ways of adding rows to grid Adding and copying restrictions Adding new empty rows Copying existing rows

Row deleting Row moving and dragging Row selecting Row height Row API Space rows
Features
Sorting rows

Sort settings Controlling sort position Comparing strings Sorting actions Sorting API

Grouping rows to tree

Group settings Creating groups Comparing strings Created group rows <D Group='1'/> User interface to choose grouping Grouping actions and API

Filtering rows

Filter settings Comparing strings User interface to choose filter Filter actions and API

Searching in rows and cells

Search settings User interface for search Search actions and API

Printing grid

Print settings Choosing items to print Page size Print API

Print / export to PDF

Introduction Client side settings Printing options Client side API Server side API Data sent from client to server

Export to Excel or CSV

Introduction and export types Basic settings Styling export XLSX export Gantt export CSV export Old XLS / XHTML export Export API Communication with server Client export Server export

Import from Excel

Basic settings Sheets manipulation

Copy & paste rows via clipboard

Copy & paste permissions Copying to clipboard Pasting from clipboard

Master - detail grids

Introduction External master - detail grids Nested master - detail grids Synchronizing grids Other attributes for master - detail

Pivot tables

Pivot attributes & API Pivot formulas

External objects (custom JavaScript objects) Undo & Redo
Gantt and bar chart
Gantt objects

Gantt objects list Display settings Edit settings

Main bar

Definition of main bar and plans Main bar as Task Edit settings Main bar content and side html Tip on mouse hover Vertical position and height Style specific attributes API to manipulate Main bars Actions Side text (deprecated) Real Flow (deprecated)

Run bar

GanttRun Definition Extended definition Run bar as Task Edit settings Save format Selecting Run boxes Run box content and side html Tip on mouse hover Box identification Vertical position and height Style specific attributes Overlaid (Error) boxes Containers for more boxes Dragging - moving and resizing API to manipulate Run boxes Actions Run special formulas

Summary task

Main for Main Main for Run Editable Main Editable Run

Gantt icons - Flag & Point

Flag - icon with text Point - math points

Gantt display objects

Header - column captions Cell and column Background Vertical movable Line Mark & Progress line

Gantt zoom

Zoom options Chart size limits Zoom selection Paging in Gantt chart

Dependency, constraints & schedule

Introduction Data units Defining dependencies Dependency colors and shapes Changing dependencies Correcting dependencies Scheduling algorithm Project date constraints Task date constraints Critical path - Slack (Float)

Gantt calendars

Global base calendar Local calendar Calendar list Calendars dialog Other settings

Gantt resources

Resources list Resources assign Resources filter Resources calculations Availability chart Resource usage chart Generated resource usage chart

Gantt popup menu Gantt API
Line and XY points charts

Charts in grid cells Chart JSON definition Base chart settings Basic attributes Size Axis and caption Individual chart lines Data sources Visual settings API for standalone usage

Paging in large grids
Paging root rows

Paging types and attributes Auto adding root pages API for paging

Pager components

Side pager Side pager type Pages Side pager type Gantt Side pager type Custom Pager with navigation buttons & edit Pager as list of page indexes

Paging in tree

ChildPaging - load / render on expand MaxChildren - limit children count ChildParts - load / render on scroll

Paging columns

Paging types and attributes Auto adding column pages API for column paging

Server paging

Server paging for root rows Server communication in root paging Root paging in very large tables Server paging in tree Server communication in tree paging XML Request for Data in root paging XML Download Data in root paging XML Request for root Page / children XML Download root Page / children API for server paging

TreeGrid DLL/SO for server paging

Introduction Compatibility with TreeGrid control Using TreeGrid server DLL/SO ASP.NET C# ASP.NET VB PHP JSP Java TreeGrid server concepts Function reference Calculations

JSON menus and dialogs
JSON menu description JSON menu definition example
Menu settings

Base attributes Visual settings Key navigation Behavior Size and scroll

Menu item settings

Base attributes Clickable item Inactive caption Collapsible sub level Popup sub menu Columns Bool item Enum item Edit item

Custom menu in JavaScript

Show custom menu Custom menu position Custom menu advanced settings Custom menu JavaScript events Custom menu JavaScript methods

Calendar dialog Custom calendar & JavaScript events Custom dialog in JavaScript
Global grid settings
Grid size and scroll

Default behavior Maximize grid height and width Update size according to the content Let a user to control the grid size Widths of individual sections Other scrolling attributes and API

Media rules - responsive design
Languages

Language & regional setup (Text.xml) Translate texts dynamically Change language

Grid cursor - Focus & hover

Focused cell and row Focused cell range Move and copy focused cells Filling cell values by dragging Tabulator navigation Key navigation Cursor look - focus & hover

Selecting rows, cells and columns

Selecting base Selecting rows Selecting cells Selecting columns

Global settings

Status messages Configuration menus Configuration menu - options Configuration menu - columns Configuration menu - print / PDF Configuration menu - export Default toolbar Useful API function Help file

Animations

Animations base Row animations Column animations Cell animations Animations for undo / redo Animations for server side changes Dialog animations

Grid configuration in cookies
Mouse & key events & actions

List of event handler types TreeGrid mouse events Mouse event names Key and mouse button prefixes Touch event names Event targets Assigning event actions / callbacks Event action parameters Action name suffix Calling actions from JavaScript Creating custom actions Focused vs. Actual cell TreeGrid key events JavaScript API events

Mouse API event TreeGrid files
Debugging and testing

Debug window Automated testing

Print grid

TreeGrid documentation

User can print grid by clicking to Print button on toolbar.
TreeGrid opens new window and renders here the grid again and calls standard window.print method to show printing dialog and print the grid. The printing process itself cannot be controlled by JavaScript at all.

In TreeGrid print menu it is possible to choose which columns or rows to print and set various printing options.
See Configuration menu for basic settings or Print menu for special settings.

The grid rendered for printing does not show scrollbars, but displays the whole grid. It does not show right side pager. All other parts visibility can be controlled by CanPrint attributes.
More changes for printing can be done by <Media><M Media='Print' ... /><Media>.

Because TreeGrid uses background images, a user must have permitted "Printing background images" in his browser to successfully print the grid.
new 7.1 chg 12.1 upd 13.2 <Cfg> int

PrintLocation

[3/0]
Where the printable grid will be shown
0 - new window with PrintWindowProp properties
1 - new window with the same properties as the main window, ignores PrintWindowProp
2 - into the main tag instead of actual grid, like with NoVScroll / NoHScroll settings, ignores PrintCSS, PrintAllCSS, PrintHead and PrintWindowProp
3 - into the same page, instead of the page content, ignores PrintCSS, PrintAllCSS, PrintHead and PrintWindowProp
4 - (new 13.2) into the same page, but hides page content. Similar to 3, but more safe. Cannot be used if the page contains absolutely positioned content.
Since 12.1 default value changed to 3 in top window or to 0 in frame / iframe.
To modify other page content for printing use OnPrintFinish and restore the original in OnPrintClose.
new 7.1 <Cfg> int

PrintPrint

[1]
How the grid will be printed
0 - nothing will be shown
1 - print dialog will be shown
2 - alert for manual printing will be shown, remember to permit printing icons in the browser by PrintLocation.
3, 4 - reserved
5 - print preview in IE will be shown if permitted the ActiveX, otherwise like 1
6 - print preview in IE will be shown if permitted the ActiveX, otherwise like 2
new 7.1 <Cfg> string[ ]

PrintGrids

To print more grids at once.
A list of grid ids, comma separated, to print them all in one print job, at the same page.
Set individual PrintPrefix / PrintPostfix to separate or structure the grids on page.
The PrintLocation, PrintPrint, PrintCSS, PrintAllCSS, PrintHead and PrintWindowProp are read from the actual grid, the other printing properties from the individual grids.
If set PrintLocation = 2, all grids are replaced inside their main tags, for other options are printed in the listed order.

If you use PrintPageHeight to split the grid vertically, you should permit it only in the main grid (with PrintGrids attribute) and the other grid(s) should have constant height.
In this case this constant height set to the PrintPaddingHeightFirst or PrintPaddingHeightLast attribute of the main grid to preserve space for the other grid(s).
new 6.0 upd 6.7 <Cfg> int

PrintCols

[2]
If and which menu will be shown before printing.
0 - no menu
1 - menu with columns to select which columns will be printed. Only columns with CanPrint='1' and '2' are listed.
2 - (new 6.7) menu with column and also with printing options
See Configuration menu for basic settings or Print menu for special settings.
upd 6.7 <Cfg> int

PrintRows

[50]   Saved to cookies, to not load it, set PrintLap='1'
For how many rows will be displayed and updated progress bar. Displaying progress bar suppresses also message about slow script. 0 never shows progress bar.
Too small value can slow down the printing.
It is used also as page length for PrintPageBreaks.
Since 6.7 it can be changed via print menu and is saved to cookies.
new 7.1 <Cfg> int

PrintCount

Expected count of rows to print to show it in progress dialog.
Usable especially when set PrintLoad = 1.
Can be set dynamically in OnPrintInit API event.
<Cfg> string

PrintPrefix

HTML code added in front of TreeGrid when printing, only before the first page.
<Cfg> string

PrintPostfix

HTML code added behind TreeGrid when printing, only after the last page.
new 7.1 <Cfg> string

PrintHead

HTML code added into the print page <head> tag. Useful for adding meta tags to the page.
Only for PrintLocation = 0 or 1
<Cfg> string

PrintCSS

Url of CSS style sheet for printing used instead of default CSS style sheet
Only for PrintLocation = 0 or 1
new 14.0 <Cfg> bool

PrintAllCSS

If set, adds all <style> tags from original page to the print page.
If not set, adds only all style links and TreeGrid CSS styles.
Ignored if set PrintCSS or set PrintLocation = 2.
new 10.0 <Cfg> string

PrintAddCSS

Url of CSS style sheet added for printing. Used with PrintCSS or with default CSS styles. Can be used also to add Gantt style if required.
Only for PrintLocation = 0 or 1
<Cfg> string

PrintWindowProp

Properties of printing window (the third attribute to window.open)
Only for PrintLocation = 0

Choosing items to print

Shared for printing and printing to PDF.
new 6.0 upd 9.0 <I> int

CanPrint

[0/1/2]
If the row will be printed.
0 - never, 1 - once if visible, 2 - on every page (only for fixed and space rows) if visible,
3 - (new 7.1) once always, 4 - (new 7.1) on every page (only for fixed and space rows) always
5 - (new 9.0) on every col page (only for space rows) if visible, 6 - (new 9.0) on every page and col page (only for space rows) if visible,
7 - (new 9.0) on every col page (only for space rows) always, 8 - (new 9.0) on every page and col page (only for space rows) always,

By default Toolbar and Panel have 0, Header has 2 and all other rows have 1.
new 6.0 upd 9.0 <C> int

CanPrint

[0/1]
If the column will be printed.
0 - never, 1 - once if visible, 2 - (new 9.0) on every page if visible,
3 - (new 9.0) once always, 4 - (new 9.0) on every page always
By default Panel has 0 and other columns 1.
More changes for printing can be done by <Media><M Media='Print' ... /><Media>.
new 7.1 <cell> int

CanPrint

[1]
If the cell will be printed. Useful especially for Space cells.
0 - never, 1 - if visible, 2 - always.
new 14.1 <C> <I> bool

MenuCheck

If the column or row is checked in the print and export menu. If not set, the item is checked according to its Visible and CanPrint/CanExport setting.
new 9.0 <cell> int

PrintHPage

[0]
Only for Space rows with CanPrint>=5.
To which horizontal page will be the cell printed. 0 means every page, 1 the first page, 2 the second page, ...
If there are fewer pages than the value, the cell will be printed at the last page.
new 9.0 <I> int

PrintHeight

Minimal height of the row when printed. In pixels. If not set, actual row height is used.
Useful especially variable height rows or rows with nested grid.
new 9.0 upd 14.0 <Cfg> int

PrintVarHeight

[1]
0 - All columns are printed as they are, without external height calculation. It can lead to higher pages than expected, if rows contain multiline cells.
1 - If there is printed at least one column with VarHeight>=1, it recalculates height of all rows for printing. It can slow down printing and print dialog recalculating, but preserves page height.
2 - Like 1 and also ignores row MaxHeight attribute to print the whole content of all multiline cells.
3 - (Since 14.0) Like 2 and never calculates row height smaller than row default height.
new 7.0 <C> int

VarHeight

[0]
Set it to 1 (or 2) to columns containing multiline cells to let their height to calculate dynamically to preserve page height. Only with PrintVarHeight>=1.
The VarHeight attribute also controls shrinking cell height when column width is increased, see VarHeight.
new 13.3 <C> int

VarHeightType

[0]
Which cells will be ignored in testing VarHeight columns for PrintVarHeight. To speed up the calculation. Bit array.
1. bit &1 - Empty cells will be ignored.
2. bit &2 - Number values will be ignored.
3. bit &4 - Texts with only letters and numbers without spaces will be ignored.
new 14.0 <I> bool

VarHeight

[1]
If the row calculates its height for printing using PrintVarHeight.
new 9.0 <C> int

PrintWidth

Width of the column when printed. In pixels. If not set, actual column width is used.
Useful especially for relative width columns.
renamed 9.2 <C> int

Block

[0]
Controls splitting columns among horizontal pages, it is useful especially if there are some cells spanned to or from other columns.
If set to > 0, it is the group the column belongs to. Create groups that contain the spanned cells. The groups must be continuous.
The group of columns is divided to more pages only if it is wider than the page width.
If spanned cell is split between printed pages, its content is printed to every page!
This attribute controls also dragging columns, see Block.
Since 9.2 it was renamed from Group.
renamed 6.0 upd 6.7 <Cfg> bool

PrintExpanded

[0]   Saved to cookies, to not load it, set PrintLap='1'
If prints all rows expanded.
If set to 0, only actually expanded rows prints their children.
Since 6.7 it can be changed via print menu and is saved to cookies.
new 6.7 <Cfg> bool

PrintFiltered

[0]   Saved to cookies, to not load it, set PrintLap='1'
If prints all rows, including the hidden.
It can be changed via print menu and is saved to cookies.
new 9.0 <Cfg> bool

PrintSelected

[0]   Saved to cookies, to not load it, set PrintLap='1'
If prints only selected rows, columns or cells.
Even if set, it always prints all rows and columns that cannot be selected.
new 15.0 <Cfg> bool

PrintOnlyData

[0]   Saved to cookies, to not load it, set PrintLap='1'
If set, does not print empty styled rows and empty styled columns if set AutoPages / AutoColPages.
Useful for xlsx that contain incorrectly styled rows or columns.
new 7.1 upd 14.0 <Cfg> int

PrintLoad

[0]
Set to 1 in server paging or child paging to download all rows to be printed.
Since 13.1 if set to 2 it downloads all rows also if set PrintSelected - useful if row selection is saved on server.
Since 14.0 if set to 3 it downloads all rows on start synchronously also for asynchronous pages.
Be careful permitting this option, it will download all pages and optionally child pages, when set PrintExpanded.
The count of rows is not known, so the progress dialog does not show correct values except set PrintCount.
new 6.7 <Cfg> bool

PrintCheckboxes

[0]
For 1 it prints all checkboxes and radio buttons as standard HTML checkbox and radio button inputs instead of style images.
Useful when expected printing without background images.
new 7.1 upd 8.1 <Cfg> int

PrintIcons

[1]
For 0 it does not print cell side icons Calendar, Enum and Defaults. It still prints Sort, Filter, Expand and custom icons.
(Since 8.1) For -1 it does not print Calendar, Enum and Defaults and custom icons. It still prints Sort, Filter, Expand.
new 9.0 upd 13.3 <Cfg> int

NoPrintTreeLines

[ ]
If set to 1, it does not show connecting lines in tree when printing, shows only expand / collapse buttons.
If set to 2, it is set to 1 in Chrome/Safari and to 0 in other browsers, as the WebKit has problems with printing tree lines.
If empty, uses value of NoTreeLines.
new 8.0 <Cfg> bool

PrintVisible

[0]   Saved to cookies, to not load it, set PrintLap='1'
Only for Gantt chart. If set, it prints only visible part of the actually scrolled / zoomed Gantt chart (horizontally).
It can be changed via print menu and is saved to cookies.
new 8.0 chg 13.2 <Cfg> int

PrintGanttBackground

[1]
If prints global Gantt background, shown for attributes GanttBackground, GanttExclude, GanttBase, GanttFinish.
Since 13.0 if set to 2 or to 4, it prints background in <svg> to speed up the rendering.It can cause problems for some PDF exporters.
Since 13.2 if set to 1 or 2 it prints the global background once on the grid background, if set to 3 or 4 it prints the global background in every row background - more compatible but remarkably slower.
Since 13.2 the default value was set back to 1 because 2 has problems with PDF exporters.
new 13.2 <Cfg> int

PrintGanttRowHeight

[50]
Default height in pixels of all Gantt objects in grid when printing.
Default height of Gantt objects is 5000px when rendering, but in PDF it slows down the PDF, so it is reduced to row height.
Increase this value to maximal expected row height if exporting to PDF a Gantt with variable row heights (e.g. with type Lines).

Page size

Shared for printing and printing to PDF.

It is possible to split the printed grid horizontally and vertically to more pages.
The maximal size of page is set by PrintPageWidth - PrintPaddingWidth x PrintPageHeight - PrintPaddingHeight. If the grid is bigger, it is split to more pages.
Note, nested grid is never split to pages.

These settings do not affect the paper size, orientation and margins selected by a user in his printing dialog! JavaScript cannot control or even read these settings!
So a user must always select the same values twice, in TreeGrid print dialog and browser/system print dialog.

If there are printed empty pages between normal pages, it often helps increasing PrintPaddingHeight.
new 9.0 <Cfg> int

PrintPageWidth

[643]   Saved to cookies, to not load it, set PrintLap='1'
Width of page for printing, in pixels.
If the printed chart is wider than this value, it is split to more pages horizontally.
The grid is always split between columns, only Gantt type column can be divided to more parts if set PrintGanttSplit = 1.
Every page contains all columns with CanPrint = 2 and next set of columns with CanPrint = 1.
If the place for the next columns is less than 100 pixels, the grid is not split horizontally.
If set to 0, the printed chart is not split to pages horizontally. Also items for page width are hidden from print columns menu.
To only hide the Page width option from print columns menu, add <Lang><Text PrintWidth=""/></Lang>.
Value 643 corresponds with page A4 portrait, 96 DPI and 40mm margin.
Remember, this attribute cannot control the final printing page chosen by user in printing dialog!
new 9.0 <Cfg> int

PrintPageHeight

[971]   Saved to cookies, to not load it, set PrintLap='1'
Height of page for printing, in pixels.
If the printed chart is higher than this value, it is split to more pages vertically.
The grid is always split between rows.
Every page contains all rows with CanPrint = 2 and next set of rows with CanPrint = 1.
If set to 0, the printed chart is not split to pages horizontally, except set PrintPageBreaks. Also items for page height are hidden from print columns menu.
To only hide the Page height option from print columns menu, add <Lang><Text PrintHeight=""/></Lang>.
Value 971 corresponds with page A4 portrait, 96 DPI and 40mm margin.
new 9.0 <Cfg> int

PrintPageSize

[8]   Saved to cookies, to not load it, set PrintLap='1'
Affects only TreeGrid print dialog (shown by PrintCols=2).
Selected item in Page sizes list, defined by <Lang><Text PrintPageSizes/></Lang>, by default in Text.xml
The PrintPageSizes attribute contains first character separated list as "|name1|width1|height1|name2|width2|height2|name3|..."
The name is page size name shown in the list, width and height is the page size in millimeters. pixels = mm / 25.4 x DPI
When changed by a user in the print dialog, it recalculates PrintPageWidth and PrintPageHeight attributes accordingly.
PrintPageWidth = (PrintPageSize[width] - PrintMarginWidth) / 25.4 * PrintDPI
PrintPageHeight = (PrintPageSize[height] - PrintMarginHeight) / 25.4 * PrintDPI
If set PrintPageOrientation to 1 (landscape) it just swaps the width and height in PrintPageSize.
new 9.0 <Cfg> int

PrintPageOrientation

[0]   Saved to cookies, to not load it, set PrintLap='1'
Affects only TreeGrid print dialog (shown by PrintCols=2).
The print page orientation - portrait or landscape.
If set to 1 (landscape), it just swaps width and height in PrintPageSize.
new 9.0 <Cfg> int

PrintDPI

[96]   Saved to cookies, to not load it, set PrintLap='1'
Affects only TreeGrid print dialog (shown by PrintCols=2).
DPI (PPI) ratio - pixels per inch.
Default value for most browsers is 96. Changing this value zooms the printed page, higher value = bigger page.
When changed by a user in the print dialog, it recalculates PrintPageWidth and PrintPageHeight attributes accordingly.
new 9.0 <Cfg> int

PrintDefaultDPI

[96]
Affects only TreeGrid PDF print dialog (shown by PrintCols=2 in PDF export).
Default PrintDPI value, used when PDFFitPage is changed to 0.
new 9.0 <Cfg> int

PrintMinDPI

[96]
Affects only TreeGrid PDF print dialog (shown by PrintCols=2 in PDF export).
Minimal PrintDPI value, used when PDFFitPage is changed to >0. If the value is less than 96, it permits stretching the grid width to fit the page. It should not be higher than 96.
new 9.0 <Cfg> int

PrintMarginWidth

[40]
Affects only TreeGrid print dialog (shown by PrintCols=2).
Left + right margin of the page, in millimeters. (pixels = mm / 25.4 x DPI)
When changed by a user in the print dialog, it recalculates PrintPageWidth attribute accordingly. It is subtracted from page width.
new 9.0 <Cfg> int

PrintMarginHeight

[40]
Affects only TreeGrid print dialog (shown by PrintCols=2).
Top + bottom margin of the page, in millimeters. (pixels = mm / 25.4 x DPI)
When changed by a user in the print dialog, it recalculates PrintPageHeight attribute accordingly. It is subtracted from page height.
new 12.0 <Cfg> float

PrintMarginDiv

[1]
Shows the PrintMarginHeight and PrintMarginWidth in Print columns menu divided by this value. Set PrintMarginDiv='25.4' to display the margin values in inches.
new 9.0 <Cfg> int

PrintPaddingWidth

[0]
Reserved width on page (in pixels), for other content on page, e.g. for PrintPagePrefix / PrintPagePostfix or HTML body margin / border / padding
It is subtracted from PrintPageWidth when printing, not in the print menu.
new 9.0 <Cfg> int

PrintPaddingHeight

[0]
Reserved height on page (in pixels), for other content on page, e.g. for PrintPagePrefix / PrintPagePostfix or HTML body margin / border / padding
It is subtracted from PrintPageHeight when printing, not in the print menu.
new 9.0 <Cfg> int

PrintPaddingHeightFirst

[0]
Reserved height on the first page, for other content on the first page, e.g. for PrintPrefix
It is subtracted from PrintPageHeight when printing, not in the print menu.
For grid split horizontally, it is added to every first page (to preserve the horizontal page synchronization).
It is used along with PrintPaddingHeight, not instead of it.
new 9.0 <Cfg> int

PrintPaddingHeightLast

[0]
Reserved height on the last page, for other content on last first page, e.g. for PrintPostfix
It is subtracted from PrintPageHeight when printing, not in the print menu.
For grid split horizontally, it is added to every last page (to preserve the horizontal page synchronization).
It is used along with PrintPaddingHeight, not instead of it.
new 9.0 upd 15.0 <Cfg> int

PrintConstWidth

[0]
If set, all pages will get the same, maximal, width.
If set to 1: by adding right empty column. Useful to preserve width of space rows.
If set to 2 (new 14.0): by resizing the last column in the printed section. Useful to preserve width of spanned cells.
If set to 3 (new 15.0): by resizing all columns with by the same ratio. Useful to preserve width of spanned cells.
If set to 4 (new 15.0): by resizing the last column in the printed section if contains spanned cells or by resizing all columns with by the same ratio. It can be slower.
new 14.1 <C> bool

PrintConstWidth

[0]
If set PrintConstWidth to column, resizes the column to get the printed page maximal width.
new 9.0 <Cfg> bool

PrintGanttSplit

[1]
If Gantt chart column can be split if it is wider than selected page by PrintPageWidth.
The individual Gantt pages dates will be rounded to GanttPrintRound or if not set, to GanttUnits.
new 9.0 <Cfg> int

PrintGanttSplitMin

[100]
Minimal size in pixels of printed part of Gantt when split by PrintGanttSplit.
It affects the first and last page part of the printed Gantt.
new 14.0 <Cfg> bool

PrintSplitRowSpan

[1]
If the horizontally spanned cells can be split to two pages.
renamed 6.0 upd 6.7 <Cfg> bool

PrintPageBreaks

[0]   Saved to cookies, to not load it, set PrintLap='1'
Prints page break after every PrintRows variable rows.
For every page it prints new table with all fixed and space rows that have CanPrint='2'
Since 6.7 it can be changed via print menu and is saved to cookies.
It does not affect PrintPageHeight, both these attributes can be used separately or together.
new 9.0 <I> bool

NoPageBreak

[0]
If set to 1, grid does not break page before the row, except it would lead to higher page.
new 7.1 upd 9.0 <Cfg> bool

PrintPageRoot

[0]   Saved to cookies, to not load it, set PrintLap='1'
For 1 it prints page break only between root rows (preserves printing children with their parent).
It breaks children only the parent children are higher than page height or PrintRows, in this case (since 9.0) it tries to preserve at least sub children on next tree levels, if any.
Since 9.0 it can be changed via print menu and is saved to cookies and also never creates higher page than PrintRow.
new 9.1 <Cfg> int

PrintPageRootMin

[10]
Minimal count of rows on page when applied PrintPageRoot, to avoid pages with only few rows.
new 9.0 upd 14.0 <Cfg> string

PrintPagePrefix

HTML code added in front of every TreeGrid page when printing.
If it contains these strings, they are replaced by: %1 horizontal page index, %2 vertical page index, %3 page index, %4 horizontal page count, %5 vertical page count, %6 page count, %7 page width in pixels, %8 page height in pixels, %9 (since 14.0) full css style/size/scale class.
The page counts (%3,%4,%5) should not be used with PrintLoad.
new 9.0 upd 14.0 <Cfg> string

PrintPagePostfix

HTML code added behind every TreeGrid page when printing.
If it contains these strings, they are replaced by: %1 horizontal page index, %2 vertical page index, %3 page index, %4 horizontal page count, %5 vertical page count, %6 page count, %7 page width in pixels, %8 page height in pixels, %9 (since 14.0) full css style/size/scale class.
%0 (new 14.0) the rest of empty height on printed page in pixels, useful to use in margin-top to place the postfix to bottom of every page.
The page counts (%3,%4,%5) should not be used with PrintLoad.
new 12.0 chg 12.1 <Cfg> int

PrintZoomFit

[1]
If set to 1, it shrinks the printed grid pages to be always printed whole regardless on page size, orientation and margin chosen in system / browser print dialog.
If set to 2, it works as 1 and also resizes too small grid pages to fill at least one direction of the printed page.
Using this attributes cancels the requirement to choose the same pages size, orientation and margins in TreeGrid print dialog and system / browser print dialog.
If the attribute is set, it also uses PDFFitPage and shows this option in print menu.
This attribute is ignored if set PrintLocation=2. This attribute is ignored in IE8 and older.
Since 12.1 default value changed from 0 to 1.
It is fully supported in IE9+ and Chrome. It has small problems in Safari. In Firefox it requires setting the same page margins in TreeGrid print dialog and system print dialog. Edge cannot be used for printing because it does not print background images.
new 6.7 chg 12.0 <Cfg> int

PDFFitPage

[0]   Saved to cookies, to not load it, set PrintLap='1'
Shrinks or resizes the printed grid to be printed in one page in given or both directions.
0 = Real size, 1 = Width, 2 = Height, 3 = Single page.
Since 12.0 this attribute is used not only for PDF export, but also for normal printing to printer if set PrintZoomFit.
new 14.0 <Cfg> int

PrintFromPage

If set, starts printing from this page, 1 means the first page.
If the start page is outside actual pages, the OnPrintEmpty is called.
new 14.0 <Cfg> int

PrintToPage

If set, ends printing by this page (including it).
new 15.0 <Cfg> int

ShowPrintPageBreaks

[0] Saved to cookies, to not save it set ShowPrintPageBreaksLap='1'
If it can show page breaks in (not printed) grid to mark which row / columns will be printed to which page.
-1 - The page breaks are hidden and cannot be shown.
0 - The page breaks are hidden and can be shown.
1 - The page breaks are shown and can be hidden. Can slow updating large grids.

Print API

<Actions>

Print

Attached to event OnClickButtonPrint
Shows printable version or grid and displays dialog for printing.
new 6.0 API event bool

OnPrintStart

(TGrid grid)
Called before the print report is generated.
Return true to cancel printing.
new 7.1 upd 12.1 API event void

OnPrintInit

(TGrid grid, string[Name] Cols, string[id] Rows)
Called after users selected columns to print and before the print report is generated.
Cols is array of all columns to print, by column name. If the column is not listed, it is not printed.
Rows (new 12.1) is array of rows to print, by row id. If the row is not listed, it is printed according to its CanPrint value.
It is possible to modify these arrays. They are null when set PrintCols = 0.
Other settings like rows per page are already read from configuration and can be modified in the grid attributes.
Here is possible to modify also PrintCount attribute when printing in server paging.
chg 6.0 API event string

OnPrint

(TGrid grid, Window window, string report)
Called after the print report has been generated, but before it was written to the print window and printed.
Return true to cancel printing or own print.
Or return new or updated report to print.
window is new window created for printing and should be closed when OnPrint returns true.
report is the generated grid HTML that will be printed.
API event bool

OnPrintFinish

(TGrid grid, Window window)
Called after print report is written to the window and before the printing dialog is displayed.
window is browser's window that contains the report.
You can also use this event to get back changes you done in OnPrintStart event, if any.
Return true to suppress default action. You can call here window.print() in this event and do some action after, for example to close the window.
new 7.1 API event void

OnPrintClose

(TGrid grid, Window window)
Called when the print window is being closed or the print report is to be deleted and the original grid restored (depends on PrintLocation settings).
window is browser's window that contains the report.
Here you can take back changes you done in page in OnPrintFinish, especially for PrintLocation >= 2.
new 14.0 API event void

OnPrintEmpty

(TGrid grid)
Called if here is nothing to print - the PrintFromPage, PrintToPage range is outside the actual pages.
API event string

OnGetHtmlValue

(TGrid grid, TRow row, string col, type val)
Called to get formatted cell value to display. val is unformatted cell value.
Returns formatted value. If returned value is not null, it is used instead of internal formatting by Format or Enum attributes.
Return null to use default formatting behavior.
It can be used also for printing, to print different value than cells show, for example:
Grids.OnPrintStart = function(G){ Grids.OnGetHtmlValueTmp = Grids.OnGetHtmlValue; Grids.OnGetHtmlValue = function(G,row,col,val){ /* here modify and return the values for printing */ } }
Grids.OnPrint = function(G){ Grids.OnGetHtmlValue = Grids.OnGetHtmlValueTmp; }
chg 6.0 API method string

GetPrintable

(function func)
Generates print report for the grid.
If func is not set, it generates the report synchronously without displaying message and returns the generated report.
If func is set, it generates the report asynchronously, shows and updates progress message and after finish calls func (report).