News in version
TreeGrid Gantt chart SpreadSheet Examples Documentation Download Development Licensing Prices References Contacts Buy Try it free
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 React Vue Other frameworks NodeJS server

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

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


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

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
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 (like Adobe Flash) 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

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 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

Export to Excel

TreeGrid documentation

Export of grid data to MS Excel in xlsx or xhtml format, to csv, or any other format.
For IE9 and older IE versions it requires communication with server.
Other browsers can save the exported file directly or can send it also to server.

The xlsx export and direct saving without server access was added in 12.1 version.

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

Changes for client export can be done also by <Media><M Media='Export' ... /><Media>.

Export types

Direct export (since 12.1)
The exported data are created on client and saved as xlsx, csv or xls file directly to disk.
It is fully done by TreeGrid. Not supported in IE9 and older.

Client export
The exported data are created on client as xlsx, csv or xls, sent to server for validation and returned back to client.
It is done by TreeGrid and needs very short server script to return the data back.
Used instead of direct export in IE9 and older.

Server export
To server is sent only configuration in XML or JSON and server generates the data and sends them back to client.
It is done by custom server script that must be written by developers using TreeGrid.
There can be used also TreeGrid.dll/so as support library to generate the exported data on server side, but it supports only old xls format.
Server export is often required for server paging and server child paging to avoid loading all data to client.

Basic settings

Basic definition of export to MS Excel XLSX, XLS, CSV or any other custom type. Shared by all export types (direct, client and server).
new 6.0 chg 12.1 <Cfg> string


["xlsx"] Saved to cookies, avoid it by <Cfg ExportLap='1'/>
If and in which predefined format the export will be done. Case insensitive.
It is also file extension to save the report by, always lowercase.
Since 12.1 the values completely changed and replaced Export_Type.
Possible values: empty - no export, xlsx - (original binary Excel xlsx file), csv - comma or semicolon separated values, xls - (old xhtml file, for compatibility).
It can contain also any other value for custom export into this file format.
new 12.1 <Cfg> string


["Export"] Saved to cookies, avoid it by <Cfg ExportLap='1'/>
File name to save the export by. It is without extension, extension is set by ExportFormat.
chg 15.0 upd 16.1 <Cfg> string[ ]


["Expanded,Outline,ForceBorder,TextType,Strings"] Saved to cookies, avoid it by <Cfg ExportLap='1'/>
The way of client export (or server export via TreeGrid.dll/so) to Excel, comma separated list of keywords, case insensitive.
Many of these options can be changed in configuration menu, if set ExportCols = 2.
Since 12.1 the default value changed, Indent was replaced by Outline.
Filteredxlsx, csv, xlsexport also filtered rows
HideFilteredxlsx(new 16.1) export filtered rows as hidden, only if not set Filtered.
Selectedxlsx, csv(new 12.1) export only selected rows, columns or cells.
In xlsx, if set FormulaEditing and not the NoFormula flag, the unused rows and columns are exported to xlsx too, but hidden.
If selected some rows and some columns and selecting cells is not permitted, it exports only their intersection. If nothing is selected, exports focused rows, columns or cells.
Expandedxlsx, csv, xlsexport all rows expanded
Hiddenxlsxexport all columns, including hidden (Visible='0' CanExport='1'). (since 12.1) export also manually hidden rows (Visible='0' Hidden='1' CanExport='1').
Hidexlsx (new 12.1, with option Hidden only) Hidden columns (Visible='0') are exported as hidden. Manually hidden rows (Visible='0' Hidden='1') are exported as hidden.
HideGroupColsxlsx (new 16.1) exports all columns hidden by grouping as hidden.
Outlinexlsx, csv, xlsexport tree as Excel outline, for csv adds new column with the outline as characters '#'
Indentxlsx, csv, xlsindent levels in main column
Selectionxlsx(new 15.0) export selected rows, columns and cells as Excel selection. If not set, the selected rows/columns/cels are colored by background color, except if set NoColor flag
Focusxlsx(new 15.0) export focused cell or range as Excel cursor.
FixedRowsxlsx(new 12.1) freeze (anchor) head rows. Note, Excel does not support freezing foot rows.
FixedColsxlsx(new 12.1) freeze (anchor) left columns. Note, Excel does not support freezing right columns.
Emptyxlsx, csv, xls(new 12.1) export empty cells as actual cells with empty string - overflowing text of preceding cells will be hidden, but the resulting xlsx file of large grids may be larger. Since 15.0 in csv exports empty cells as one space.
KeepHTMLxlsx, csv(new 12.1) places HTML tags to export, does not convert them to Excel style in xlsx or does not remove them in csv.
EnumKeysxlsx, csv(new 12.1) for Enum and Radio type exports its keys, not values
TextTypexlsx(new 12.1) preserves Text type for number values. Otherwise it converts type of number values to number type.
Strings                xlsstore strings in file twice to preserve their type a spaces, set it if you want to export all strings as strings and not chosen by Excel.
Boolxlsx, csv(new 15.0) exports Bool type and Auto boolean as TRUE / FALSE to xlsx or as CSVBool to xls and csv.
Currencyxlsx, csv(new 15.1) exports actual currency instead of "$" in number currency format.
Languagexlsx(new 16.1) exports all date and some number formats in actual TreeGrid language and forces Excel to display this locale. It does not affect decimal and thousand separators!
Unsupportedxlsx(new 12.1) exports also TreeGrid date and number formats that are not fully supported by Excel, the unsupported part is replaced by '?' (since 15.0 defined by <Lang><Format Unsupported="\?"/></Lang>). Otherwise, if not present, exports such dates as string.
StyleNumbersxlsx(new 15.0) converts numbers and dates to formatted strings, if the Format contains HTML. If not present, the HTML is just removed from the Format.
StyleRowsxlsx(new 15.0) sets row attributes to the whole rows to style/format empty cells right to the exported table.
StyleColsxlsx(new 15.0) sets column attributes also to the whole columns to style/format empty cells below the exported table.
NoNextColsxlsx(new 15.0) hides all not used columns outside exported table
NoNextBorderxlsx(new 15.0) hides border in all not used rows and columns outside exported table
NoColorxlsx,        xls(new 14.0) does not export row/col/cell Color attribute and does not color selected cells and header.
NoStylexlsx(new 15.0) does not export any row/col/cell style or border, exports only values or formulas.
NoSpanxlsx,        xls(new 15.0) does not export row and column span.
NoWrapBRxlsx(new 16.0) does not automatically force Wrap=1 for cells containing <br> in Html / EHtml type or LF in Lines type.
NoFormulaxlsx(new 15.0) does not export editable formulas, exports the formula results in values.
NoHtmlPrefixxlsx(new 16.1) does not export HtmlPrefix and HtmlPostfix attributes, useful for import.
NoBOM       csv, xls(new 15.0) does not add UTF8 "EFBBBF" BOM to beginning of xls / csv.
Sizexlsx,        xls(new 15.0) preserves default font size and column width according to the style Size.
If not set, it always exports the same column widths and font size regardless on the style Size - it can export different column widths than actually displayed.
ForceBorderxlsx(new 15.0) forces displaying default border between cells when set cell background color or colors header or selection
GMTxlsx, csv, xls(new 15.1) to export dates in GMT regardless on GMT attributes. It was default value prior 15.1.
If not set, the GMT=0 dates are exported as displayed in TreeGrid (the xlsx will differ according to timezone where exported).
Dates                xls export dates as strings only (useful for exporting Hirji dates).
Rtlxlsx, csv, xls(new 7.1) the columns will be exported in reversed order when the grid is in Rtl mode. Since 15.0 it switches xlsx to Rtl mode.
TreeGridxlsx(new 16.1) exports TreeGrid id (TGid), grouping setting (TGGroup) and rows excluded from import (TGIgnoreRows) to the sheet names.
Used for exporting xlsx that can be imported by ImportRows.
ColNamesxlsx(new 16.1) exports all column names (TGCol_xxx) to the sheet names.
Used for exporting xlsx that can be imported by ImportRows.
Defsxlsx(new 16.1) exports names of default rows in last hidden column named in sheet names as (TGCol__Def).
Used for exporting xlsx that can be imported by ImportRows.
GroupRowsxlsx(new 16.1) exports all group rows in TGIgnoreGroupRows sheet name.
Used for exporting xlsx with complex grouping (not all rows have the same grouping level) that can be imported by ImportRows.
RangeCommentxlsx(new 16.1) exports all Date and number Range values (with more items) in raw English format to the cell comment.
Used also for exporting xlsx that can be imported by ImportRows.
FormatCommentxlsx(new 16.1) exports all Date and number values in formats not available in Excel in raw English format to the cell comment.
Used also for exporting xlsx that can be imported by ImportRows.
TipCommentxlsx(new 16.1) exports all cell Tip attribute values to the cell comment. It does not read the Tip from default cell, row or column.
new 6.0 upd 15.1 <Cfg> int


If and which menu will be shown before doing export.
0 - no menu
1 - menu with columns and rows to select which columns will be exported. Only columns and rows with CanExport='1' are listed.
2 - (new 6.7) menu with columns, rows and also with all options for export
3 - (new 15.1) shows the menu also if the grid shows imported xlsx
See Configuration menu for basic settings or Export menu for special settings.
new 12.1 upd 13.1 <Cfg> int


For direct or client export. Set to 1 in server paging or child paging to download all rows to be exported.
Since 13.1 if set to 2 it downloads all rows also if ExportType contains flag Selected - useful if row selection is saved on server.
Be careful permitting this option, it will download all pages and optionally child pages, when used ExportType = Expanded.
new 16.1 <Cfg> string[]


Settings for exported comments in xlsx, comma separated attributes "left,top,width,height,show,background,border".
left, top is position of the comment relative to the right top edge of the cell, cannot be negative.
width, height is size of the comment window.
show is 0 to hide the comments on start, 1 to show all comments on start.
background is background color of the comment window, can be any HTML color.
border is border color of the comment window, can be any HTML color or 'none'.
Tip as comment is exported only if set flag "TipComment" in ExportType.
new 16.1 <Cfg> string[]


Comma separated ids of grids to export.
If set and exporting to xlsx, exports all given grids to one xlsx on separate sheets.
The main grid id must be listed too to be exported.
Users in export menu can choose options, columns and rows only for the main exported grid, other grids are exported with default options.
new 16.1 <Cfg> string


[DefaultSheet or id]
Sheet name in xlsx where this grid will be saved, useful when saving more grids to one xlsx.
If not set, the DefaultSheet from Lang Alert will be used if exporting the only grid or grid id will be used if exporting more grids by ExportGrids.
upd 16.1 <C> int


If the column will be exported. 0 - no, 1 - yes, if chosen in menu or is visible, 2 - not used (now works as 3), 3 - always, 4 - (new 15.0) always even if not selected and exporting selected only, 5 - (new 16.1) always but hidden (in xlsx) or like 4 in csv/xls.
6 - (new 16.1) always and visible (in xlsx) or like 4 in csv/xls.
By default Panel has 0 and other columns 1.
More changes for client export can be done also by <Media><M Media='Export' ... /><Media>.
upd 16.1 <I> int


If row will be exported to Excel.
0 - neither row, nor its children, 1 - yes, if chosen in menu or is visible, 2 - (new 11.0) only its children, 3 (new 12.1) always, 4 - (new 15.0) always even if not selected and exporting selected only, 5 - (new 16.1) always but hidden (in xlsx) or like 4 in csv/xls.
6 - (new 16.1) always and visible (in xlsx) or like 4 in csv/xls.
Space rows are never exported.
new 14.1 <C> <I> bool


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.
chg 15.0 <Cfg> string


Since 15.0 for xlsx and csv it adds new first row with this text in its first cell. It is ignored if set FormulaEditing.
For xls it is HTML code added into Excel report between Excel header and TreeGrid table.
chg 15.0 <Cfg> string


Since 15.0 for xlsx and csv it adds new last row with this text in its first cell.
For xls it is HTML code added into Excel report between exported TreeGrid table and enclosing </body> tag
new 15.0 <cell> string


Raw cell value used for export to Excel exported as EHtml type without Format.
<cell> string


Cell value used for export to Excel. It uses the same Type as Format as the cell value.
upd 15.0 API event string


(TGrid grid, TRow row, string col, string str, string format)
Called to get value for export. format (new 15.0) is the exported format, "xlsx", "xls" or "csv".

If called from xlsx export, the format is set to "xlsx" and the str is html value to be exported as the cell value in xlsx. Return new str value for export or null to export original str.

If called from csv export, the format is set to "csv" and the str is html value that will be exported to csv, without the html tags. Return new value for export or null to export original str.

If called from xls export, the format is set to "xls" and the str is html tag ending character ('>'), so to return just string return str+your_value and to return formatted number return your_format+str+your_value.
For example: Grids.OnGetExportValue = function(G,row,col,str,format){ return " style='mso-number-format:\"$ 0.00\";'"+str+Get(row,col); }
chg 15.0 <C> <I> <cell> string


TreeGrid date time or number format to be used instead of the cell Format for export to Excel.
See ExportFormat for number type or ExportFormat for date type.
From 12.1 to 14.1 it was not used for old xls export except for ExportType="Dates", it used XlsFormat instead.
Since 15.0 it is used for all exports, including xls and it is also read from row.
new 12.1 chg 15.0 <C> <I> <cell> string


xlsx and old xls only.
Excel date time or number format to be used instead of the cell Format and ExportFormat for export to Excel.
It is exact MS Excel format string passed directly to xlsx format or to xls CSS attribute mso-number-format.
Since 15.0 it is used also for xlsx and it is also read from row.
chg 15.0 <Cfg> string


Excel cannot easily display numbers with and without decimals by one format.
How to export formats containing ".#" to show optional decimals.
0 - export formats without change, the integer numbers will end by dot (or comma in some languages).
1 - change format in cells with integer numbers to be without decimals - if is edited such cell in Excel, it will never show the decimals until the format is manually changed.
2 - replace the number format by "General" and round the exported numbers to desired decimals count.
<Cfg> int


If set, the Float number will be rounded to this count of decimal digits.
new 15.0 <Cfg> string[*]


csv and old xls only. First character separated list of three values for export in Bool type as "|0|1|empty". Used only if ExportType contains "Bool" flag.
new 15.0 <Format> string[]


Comma separated list of strings that will be exported instead of TreeGrid filter operator images.
Default value is ",= ,≠ ,< ,≤ ,> ,≥ ,|* ,|- ,*| ,-| ,*|* ,-|- "
new 15.0 <Format> string


xlsx and old xls only. Html code to use when exporting the TreeGrid filter operator.
Can contain simple HTML code that can be exported to xlsx cell like <span style='color:...;font-size:...;font-weight:...;font-style:...;'>%1</span>.
Should contain %1 string to be replaced by actual operator string chosen from ExportFilters.
Default value is "<span style='color:red;'>%1</span>".
new 16.1 <Format> string


Excel hexadecimal language code, 0409 is US English.
Used when exporting date formats to xlsx with ExportType containing Language flag.

Styling export

Global and special styles for xlsx and xls export.
new 7.0 <C> <cell> string


The CSS style added to the cell when exported.
For example to align the cell vertically to top, set ExportStyle='vertical-align:top'.

It can be used also to format the number or date value in Excel, e.g. ExportStyle='mso-number-format:"$ 0.00";' or ExportStyle='mso-number-format:"d.M.yyyy HH:mm";'
The Excel CSS attribute mso-number-format settings are similar to TreeGrid number and date formats.

In xlsx the permitted CSS attributes are exactly: mso-number-format, color, background-color, text-align, vertical-align, white-space, font-weight, font-style, font-variant, text-decoration, text-shadow, font-size, font-family, border, border-left, border-right, border-top, border-bottom.
new 12.1 chg 15.0 <Cfg> string


Colors and borders of exported cells.
HeaderColor"#F5F5F5"Color of header rows
HeadColor""(new 15.0) Color of head rows
FootColor""(new 15.0) Color of foot rows
LeftColor""(new 15.0) Color of left columns
RightColor""(new 15.0) Color of right columns
SelectedRowsColor"#FFFFA6"Color of selected rows
SelectedColsColor"#FFFFA6"Color of selected columns
SelectedCellsColor"#F0F0A0"Color of selected cells
AddedColor"#D7FFD7"(new 15.0) Color of added rows
DeletedColor"#FFE5E4"(new 15.0) Color of deleted rows
MovedColor"#DAF3F2"(new 15.0) Color of moved rows
ChangedColor"#EBEBFF"(new 15.0) Color of rows witch changed cells
ChangedCellColor"#DADAEE"(new 15.0) Color of changed cells
AlternateColor"#FAFAFA"(new 15.0) Alternate color for ExportAlternate
LinkColor"#0563C1"(new 15.0) Text color of cells with hyperlink
DefaultTextShadowColorDeleted 15.0. Replaced by ExportTextShadow. Since 15.0 the TextShadow is exported as text color, not pattern.
DefaultTextShadowPatternDeleted 15.0. Replaced by ExportTextShadow. Since 15.0 the TextShadow is exported as text color, not pattern.
TableBorder"1,black"Defines border around the table. Set it as "width,color". Since 15.0 it does not define border between sections (head, foot, left and right columns).
HeaderBorder"1,gray"Since 15.0 defines bottom border of the last Head row in Head section
HeadBorder"1,gray"Since 15.0 defines bottom border of head section
FootBorder"1,gray"Since 15.0 defines top border of foot section
LeftBorder"1,gray"Since 15.0 defines right border of the left columns section
RightBorder"1,gray"Since 15.0 defines left border of the right columns section
HeaderStyle"bold"Since 15.0 defines style of the header text, can contain comma separated flags "bold" and "italic"
For example: ExportOptions="{TableBorder:'2,gray'}"
new 15.0 <Cfg> int


Highlight odd or every N row by another color in the exported xlsx / xls.
0 - no row, 1 - every row, 2 - every odd row, every third row, 3 - every fourth row, ...
If set to empty string it uses Alternate setting also for export.
new 12.1 chg 15.0 <Cfg> int


Default Excel font size in every cell. In px, not in pt. Since 15.0 default value changed to 15.
new 12.1 <Cfg> int


Default Excel font name in every cell.
new 15.0 <Cfg> float


The column width are multiplied by this value.
Use when ExportFontSize is bigger than TreeGrid font size to resize the columns to show the whole texts like in the grid.

XLSX export

Settings specific for direct or client export to xlsx.
new 15.0 <Cfg> string[]


Which images and how to export them, comma separated list of flags, case sensitive.
Imgexports images in Img attribute and in Img type.
Htmlexports images in <img> tags in EHtml and Auto types.
Otherexports images in <img> tags in Html and Select types, HtmlPrefix, HtmlPostfix and Format.
Iconexports images in Icon type.
Sideexports images in side Icon.
Panelexports images in panel and does not export button names.
Buttonexports images in side Button.
Boolexports custom images in Bool type set in BoolIcon.
SpaceReplaces the <img> tags in Html and Auto type by spaces, otherwise the text is shifted.
IndentIndents the cell value when exported with side Icon or Button.
ResizeAttaches the images to two cells (top left and bottom right) and permits resizing the image between the cells.
Requires synchronized row heights between grid and xlsx, usually by ExportHeights >= 3.
Images set by url (not by data:) cannot be exported when run locally on file:// protocol in IE.
new 15.0 <Cfg> string[]


Which images and how to export them, comma separated list of flags, case sensitive.
Linkexports links in Link attribute and in Link type.
Htmlexports first <a> tag in EHtml and Auto types.
Otherexports first <a> tag in HtmlPrefix, HtmlPostfix and Format.
Underlineunderlines all links
new 15.0 <Cfg> string


If set, it exports TextShadowColor as text color if the text has not defined the TextColor.
It can be set to color like "red" or "#FF0000" to use this color as TextColor for TextShadow without TextShadowColor set.
If not set, the TextShadow / TextShadowColor are not exported at all.
new 15.0 <Cfg> string[]


Comma separated list of formula function names that cannot be exported to xlsx.
If formula contains any of these names, it is not exported to xlsx, the cell is exported only with its values.
new 12.1 deleted 15.0 <Cfg> int


Replaced by ExportHeights
0 - All rows are exported with single line height. Similar to ExportHeights='2'.
1 - Calculates height of cells in columns with VarHeight>=1, row height is set to the highest cell height. Similar to ExportHeights='3'.
2 - Like 1 and also ignores row MaxHeight attribute to export the whole content of all multiline cells. Similar to ExportHeights='4'.
new 15.0 upd 16.0 <Cfg> int


If and how the row heights are exported.
0 - No height; all the row heights will be calculated by Excel according to the cell content. Default row height with only empty or single line cells is calculated according to the ExportFontSize.
1 - Set height; Only heights set by row Height attribute. Rows without Height set will be calculated by Excel.
2 - Default height; All rows will be exported with default height, set by row Height or ExportRowHeight or MinRowHeight or actual CSS style height.
3 - Actual height; All rows will be exported with actual height used in TreeGrid. For not rendered rows the height is calculated, so this option can slow down export if the grid has many not rendered page or child pages.
4 - Calculated height without MaxHeight; Like 3, but ignores MaxHeight attribute to export the whole content of multiline cells. It calculates height of all rows, so this option can slow down the export if the grid contains many rows!
Since 16.0 Default value is 3 for exporting Gantt charts and 1 for exporting grids.
new 15.0 <Cfg> int


Default row height for export to xlsx. If not set, default row height in actual CSS style is used.
new 15.0 API event void


(TGrid grid, TRow row, object exrow)
Called when exporting one row to xlsx.
row is the source row being exported.
exrow is the object containing all row attributes and cell values and attributes that will be exported.
exrow does not have Def attribute, it has set all its attributes directly.
It is possible to modify the exrow to change the exported row.
new 16.1 API event void


(TGrid grid, TRow row, string col, object exrow, string excol)
Called when exporting one cell to xlsx.
row, col is the source cell being exported.
exrow, excol is the cell that contains value and attributes that will be exported.
exrow does not have Def attribute, it has set all its attributes directly.
It is possible to modify the exrow to change the exported cell, like exrow[excol] = "new value" or exrow[excol+"Tip"] = "new comment".
new 15.0 API event void


(TGrid grid, TCol column, object excolumn)
Called when exporting one column to xlsx.
column is the source column object (not name) being exported.
excolumn is the object containing all column attributes that will be exported.
It is possible to modify the excolumn to change the exported column.
new 12.1 <Cfg> bool


If third party library JSZip will be loaded and used by TreeGrid.

JSZip is library for LZ compression. It is independent on TreeGrid. It is distributed under MIT or GPLv3 license.
It can be downloaded or its licensing read at

It is loaded by TreeGrid only for client export to xlsx and import of xlsx.
To not use it at all, set <Cfg JSZip='0'/>, in this case the export will produce longer uncompressed xlsx files, but xlsx import will be unavailable at all.
new 15.0 <Cfg> int


Zip compression level for xlsx files produced by JSZip.
0 - store (not compress), 1 - the fastest compression, ... 9 - the smallest size.
Ignored when exporting imported xlsx file.
new 15.1 <Cfg> bool


If the xlsx file is uploaded to server in base64 or in blob.
Set it only if you use custom export in OnExport API event to get appropriate data format.
Default value is 1 if Export_Type is "Export" or "Save" or it is run on IE9 and older, otherwise it is 0.

Gantt export

Settings specific for exporting Gantt chart to xlsx.

Exporting Gantt chart is provided only with SpreadSheet component!

Style of Gantt objects, backgrounds, border, text properties, shapes, etc. are defined in <GanttExport> root tag in Defaults.xml/js.
The values of the GanttExport attributes are in format of xlsx OOXML, not CSS or JavaScript.
new 16.0 <C> bool


To permit exporting Gantt chart to xlsx set CanExport='1' to the Gantt column.
new 16.0 <C> string[]


Comma separated list of all Gantt objects to export, case insensitive.
The order of exported the Gantt objects. The objects exported later will overlay the previous objects in the same place.
The not listed Gantt objects are never rendered.
If not set (by default), the GanttOrder is used.
Possible keywords to use: Availability, Constraints, Run, Main, Mark, Flags, Points.
It can contain also the next main bars keywords Main1, Main2, Main3, ..., Main10. If missing, these keywords are automatically added after Main keyword if increased GanttCount.
Unlike the GanttOrder it cannot contain Chart and Dependency. Chart is never exported and dependencies are exported always above other Gantt objects.
new 16.0 <C> bool


If dependencies are exported to xlsx. Dependencies are always exported above other Gantt objects.
new 16.0 <C> int


If and how the Gantt background is exported to xlsx, bit array.
1. bit &1 - if exports GanttLines, GanttBase and GanttFinish.
2. bit &2 - if exports GanttExclude.
3. bit &4 - if exports GanttBackground.
new 16.0 <C> string


GanttUnits units for export. For every GanttExportUnits will be created xlsx column.
If not set, it is chosen as the smallest units in all GanttHeader.
If it is bigger than GanttHeader units, the header is not exported correctly.
new 16.0 <C> int


GanttWidth for exporting to xlsx. If set GanttSmoothZoom it is used only if it is higher than the GanttWidth.
new 16.0 <GanttExport> string[*]


List of all custom images used in Gantt chart for milestones and flags. If the custom Gantt image is not listed here, it is not exported..
First character separated list as "|image_url1|width1,height1|image_url2|width2,height2|image_url3...".
For example: Images="|Green.svg||Red.svg||Yellow.svg".
new 16.0 <GanttExport> int


If and how the Gantt column cells will be spanned in export. Bit array.
1. bit &1 - If set, all the cells will be spanned horizontally, the whole Gantt column will be one cell per row. If not set, every GanttExportUnits date will be one cell, the cells will have side border.
2. bit &2 - If set, removes the row border between cells in Gantt column.

CSV export

Settings specific for direct or client export to csv.
new 7.1 <Cfg> string


String or character that separates individual values in export to CSV
new 7.1 <Cfg> string


String or character that separates individual rows in export to CSV
new 7.1 <Cfg> string


Character that quotes value in export to CSV, if it contains one of the ValueSeparator, RowSeparator or Quote.
The quote characters are doubled in the value.
new 7.1 <Cfg> string


String or character to show level deep, when ExportType='Outline'
new 14.0 chg 15.0 <Cfg> type


Format for all dates exported to CSV.
0 - Dates are exported as Excel numbers (count of days since 1/1/1900).
1 - Dates are exported as they are shown in grid, in display Format.
2 - Dates are exported in editable format.
string - Dates are exported in given date format.
Since 15.0 the default value changed to 1.
new 15.0 <Cfg> type


Format for all numbers exported to CSV.
0 - Numbers are exported as unformatted numbers with dot as decimal separator.
1 - Numbers are exported as they are shown in grid, in display Format.
2 - Numbers are exported in editable format.
string - Numbers are exported in given number format.

Old XLS / XHTML export

Settings specific for direct or client export to xhtml or for export to xhtml created by TreeGrid DLL/so.
deleted 15.0 <Cfg> int


Since 15.0 the xls export is also synchronous without progress bar.

Export API



Attached to event OnClickButtonExport
Creates report in XLSX, XLS or CSV or a request for the server report and saves it to disk or sends it to server.
new 6.0 upd 7.0 API event bool


(TGrid grid, bool pdf)
Called before the export menu is shown and the export report is generated.
(since 7.0) pdf is true for export to PDF
Return true to cancel export.
new 12.1 API event bool


(TGrid grid, string[Name] Cols, string[id] Rows, object source)
Called after the options are chosen by a user in menu and before the export is generated.
Cols is array of all columns to export, by column name. If the column is not listed, it is not exported.
Rows is array of rows to export, by row id. If the row is not listed, it is exported according to its CanExport value.
It is possible to modify these arrays.
Other settings like ExportFormat or ExportType are already read from configuration and can be modified in the grid attributes.
source is data source used, can be null for direct save or grid.Source.Export for export, or grid.Source.ExportPDF for PDF export.
Can be used for custom export or export to different formats.
Return true to cancel export.
chg 12.1 upd 15.1 API event object


(TGrid grid, object data, int type)
Called after the export or configuration is created and before it is saved to disk or sent to server.
data is the created export or configuration. It can be string or (since 12.1) Blob object. Since 15.1 controlled by ExportBase64 attribute.
(since 12.1) type is data type: 0 export configuration, 1 export pdf configuration, 2 direct data to save, 3 direct data to send to server, 4 (since 15.1) direct data to send to server for save.
Return true to suppress the export.
Or return new or updated data to send.
new 12.1 API method void


(string data, object source = null)
Saves exported data to file (source = null) or sends it to server to source like grid.Source.Export or grid.Source.ExportPDF.
chg 12.1 API method void


(string data, string url, string name)
Sends the data to server as export or configuration.
Since 12.1 is does not call OnExport.

Communication with server

By default (Export_Type="") the server communication is required only for IE9 and older browsers.
chg 12.1 upd 15.1 <treegrid,bdo> string


If and what will be sent to server for export, case insensitive.

Direct export (since 12.1)

In all browsers except IE9 and below will be sent nothing to server; the generated file will be saved directly.
Only in IE9 and below will be sent to server full report in XLSX/CSV/XLS format (chosen by ExportFormat).

Client export

To server will be sent full report in XLSX/CSV/XLS format (chosen by ExportFormat).
Prior 12.1 the client export was always sent to server, using keywords "xls" or "csv"

Save (new 15.1)
To server will be sent by AJAX full report in XLSX/CSV/XLS format (chosen by ExportFormat).
Nothing will be downloaded.

Server export

To server will be sent only configuration (sorting, grouping, filters) and columns (positions, visibility and widths) in XML.
The server must generate the requested report in XLSX, XLS or CSV according to the settings and stored data and return it to client.
See Server export.

Sends ids of all expanded rows in <Cfg Expanded/> attribute, comma separated.

Used usually with Settings for server export.
Sends modified rows - rows with set attribute Added, Deleted, Moved or Changed (modified values). The rows are sent in <Changes> tag.
When set, the export does not save the changes to server before export, but includes them in the export request.

This attribute supports for server export also all other settings like Cookie or Data defined for _Type, see Upload_Type. Also Export_Flags are supported if defined, see Upload_Flags.
<treegrid,bdo> string


If set Export_Type="" (default value), it is required only for compatibility with IE9 and older IE browsers.
Destination for page that generates data to export to XLSX, XLS, CSV or any other format.
This server URL should return the exported data as XLSX / XLS file in HTTP content-type="application/" or CSV as "text/csv".
This communication is not done by AJAX, but always by hidden form, so it can be used even if no ActiveX is supported.
Export cannot use Soap or Get communication.
If you encounter problems with export of international (non-English) characters, add to your page, to <head> section:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

In client export (Export_Type='' or 'Export') to this URL is uploaded complete exported data and the server script should just return them back.
In server export (Export_Type='Settings' or other value) to this URL is uploaded actual grid configuration and the server script should create and return the exported data by itself.
<treegrid,bdo> string


The name of form input in that will be uploaded exported data or configuration to Export_Url.

Client export

By default (Export_Type="") the server communication is required only for IE9 and older browsers.

To server (to Export_Url) is sent whole prepared report that can just be returned by this page back to Excel.
The uploaded data can be plain text (for xls and csv) or base64 encoded for binary xlsx.
In "custom" parameter "ExportFormat" is sent chosen file extension "xlsx", "xls" or "csv".
In "custom" parameter "ExportName" is sent chosen file name.
Should be used only for small grids, because to server are send all data back.
Cannot be used with server paging or server child paging.
Space rows are not exported.
The server script just returns the data from Data attribute back to client with changed content type.
For MS Excel use ContentType="application/" and charset: utf-8.

Examples of server script for client export

Point Export_Url to simple server script that will just return the received data:

<%@ Page Language="C#" ContentType="application/" %>
<% Response.AppendHeader("Content-Disposition","attachment; filename=\""+Request["ExportName"])+"."+Request["ExportFormat"]+"\"");
Response.AppendHeader("Cache-Control","max-age=1, must-revalidate");
string data = Request["Data"]; if(data==null) data = "";
if (data.IndexOf('>') >= 0 || data.IndexOf("<") >= 0 || data == "") Response.Write(HttpUtility.HtmlDecode(data));
else Response.BinaryWrite(Convert.FromBase64String(data)); %>

<%@page contentType="application/"%><%@page pageEncoding="UTF-8"%><%
response.addHeader("Content-Disposition","attachment; filename=\""+request.getParameter("ExportName")+"."+request.getParameter("ExportFormat")+"\"");
response.addHeader("Cache-Control","max-age=1, must-revalidate");
String XML = request.getParameter("Data"); if(XML==null) XML = "";
if(XML.length()>0&&XML.charAt(0)=='&') XML = XML.replaceAll("<","<").replaceAll(">",">").replaceAll("&","&").replaceAll(""","\"").replaceAll("'","'");
if(XML.indexOf("<")>=0) out.print(XML);
else { O = new;
O.write(javax.xml.bind.DatatypeConverter.parseBase64Binary(XML)); O.flush(); O.close();
} %>

header("Content-Type: application/; charset=utf-8");
header("Content-Disposition: attachment; filename=\"" . $_REQUEST["ExportName"] . "." . $_REQUEST["ExportFormat"] . "\"");
header("Cache-Control: max-age=1; must-revalidate");
$XML = get_magic_quotes_gpc() ? stripslashes($_REQUEST["Data"]) : $_REQUEST["Data"];
if(strpos($XML,"<")===false || strpos($XML,"<")===false) echo(base64_decode($XML));
else echo html_entity_decode($XML); ?>

Any other language can generate the export similarly.

Server export

To server is sent just actual grid configuration – sorting, grouping, filters, search and column width, positions and visibility.
In "custom" parameter "ExportFormat" is sent chosen file extension "xlsx", "xls" or "csv".
In "custom" parameter "ExportName" is sent chosen file name.
In "custom" parameter "ExportType" is sent chosen ExportType flags.
For Export_Type="Settings", "Cols" or "Hidden", the rows and column are marked as visible if they were checked in export menu.

It is possible to upload also other data from client like changes, set Export_Type="Settings,Changes".
The configuration is sent as standard TreeGrid XML in Data attribute.
Server must generate the report from data on server by itself and return report to client.
Use this way for larger grid and/or for grids with server paging or server child paging.
Use it also if you want to generate different then standard report or you want to generate report for another program then MS Excel.

XML structure of request for server export

Used as request sent to data source Export to get the exported grid when set server side export (Export_Type="Settings").
It contains session identification and grid configuration to sort, group, filter and search exported data on server.
It contains also columns settings - width, position and visibility.

<IO ... attributes with request settings ... /> (Session attribute)
<Cfg ... attributes with grid settings read from cookies ... />
(HiddenRows, Sort, Group, ReSort, ReCalc, TimeZone attributes)
(SearchAction, SearchExpression, SearchType, SearchMethod, SearchDefs, SearchCols attributes)
(Focused, FocusedCol, FocusedPos attributes)
(PrintPageBreaks, PrintRows, PrintExpanded, PrintFiltered)
<Filter> (list of filters)
<I ... row and cell attributes ... /> (id attribute, cell values and cell Filter attributes)
... More tags <I> if more filters are in grid ...

<C Name='column name' Width='...' Visible='0/1' />
... more tags <C> for other columns ...
<C Name='column name' Width='...' Visible='0/1' />
... more tags <C> for other columns ...
<C Name='column name' Width='...' Visible='0/1' />
... more tags <C> for other columns ...