Angular Data Grid: Excel Export API Reference
This page documents the Excel Export API and Interfaces.
Grid Properties
suppressExcelExportboolean | Prevents the user from exporting the grid to Excel. Default: false | |
excelStyles | A list (array) of Excel Styles to be used when exporting to Excel with styles |
API Methods
Interfaces
ExcelExportParams:
authorstring | The author of the exported file. Default: 'AG Grid' | |
autoConvertFormulasboolean | If set to true, this will try to convert any cell that starts with = to a formula, instead of setting the cell value as regular string that starts with =.Default: false | |
columnWidthnumber | Defines the default column width. If no value is present, each column will have value currently set in the application with a min value of 75px. This property can also be supplied a callback function that returns a number: (params: ColumnWidthCallbackParams) => number. | |
exportModestring | For backwards compatibility, this property could be set to xml, which will export an Excel Spreadsheet compatible with old Office versions (prior to Office 2007). Setting this to xml is not recommended as some features will not work in legacy mode.Default: 'xlsx'Options: 'xlsx', 'xml' | |
fontSizenumber | The default value for the font size of the Excel document. Default: 11 | |
headerRowHeightnumber | Function | The height in pixels of header rows. Defaults to Excel default value. This property can also be supplied a callback function that returns a number: (params: RowHeightCallbackParams) => number. | |
rowHeightnumber | Function | The height in pixels of all rows. Defaults to Excel default value. This property can also be supplied a callback function that returns a number: (params: RowHeightCallbackParams) => number. | |
sheetNamestring | The name of the sheet in Excel where the grid will be exported. There is a max limit of 31 characters. Default: 'ag-grid' | |
appendContent | Content to put at the top of the exported sheet. A 2D array of ExcelCell objects (see Extra Content section). | |
prependContent | Content to put at the bottom of the exported sheet. A 2D array of ExcelCell objects (see Extra Content section). | |
allColumnsboolean | If true, all columns will be exported in the order they appear in the columnDefs. When false only the columns currently being displayed will be exported.Default: false | |
columnKeys(string | Column)[] | Provide a list (an array) of column keys or Column objects if you want to export specific columns. | |
fileNamestring | String to use as the file name. Default: 'export.xlsx' | |
onlySelectedboolean | Export only selected rows. Default: false | |
onlySelectedAllPagesboolean | Only export selected rows including other pages (only makes sense when using pagination). Default: false | |
margins | The Excel document page margins. Relevant for printing. | |
pageSetup | Allows you to setup the page orientation and size. | |
suppressTextAsCDATAboolean | If true, text content will be encoded with XML character entities like < and >. This is only relevant when exportMode='xml'.Default: false | |
skipColumnGroupHeadersboolean | Set to true to exclude header column groups.Default: false | |
skipColumnHeadersboolean | Set to true if you don't want to export column headers.Default: false | |
skipRowGroupsboolean | Set to true to skip row group headers if grouping rows. Only relevant when grouping rows.Default: false | |
skipPinnedBottomboolean | Set to true to suppress exporting rows pinned to the bottom of the grid.Default: false | |
getCustomContentBelowRowFunction | A callback function to return content to be inserted below a row in the export. | |
shouldRowBeSkippedFunction | A callback function that will be invoked once per row in the grid. Return true to omit the row from the export. | |
processCellCallbackFunction | A callback function invoked once per cell in the grid. Return a string value to be displayed in the export. For example this is useful for formatting date values. | |
processHeaderCallbackFunction | A callback function invoked once per column. Return a string to be displayed in the column header. | |
processGroupHeaderCallbackFunction | A callback function invoked once per column group. Return a string to be displayed in the column group header. Note that column groups are exported by default, this option will not work with skipColumnGroupHeaders=true. | |
processRowGroupCallbackFunction | A callback function invoked once per row group. Return a string to be displayed in the group cell. | |
addImageToCellFunction | A callback function invoked once per cell. Return an ExcelImage object to add an image to the current cell. |
ExcelExportMultipleSheetParams:
authorstring | The author of the exported file. Default: 'AG Grid' | |
datastring[] | Array of strings containing the raw data for Excel workbook sheets. This property is only used when exporting to multiple sheets using api.exportMultipleSheetsAsExcel() and the data for each sheet is obtained by calling api.getSheetDataForExcel(). See Multiple Sheets. | |
fileNamestring | String to use as the file name. Default: 'export.xlsx' | |
fontSizenumber | The default value for the font size of the Excel document. Default: 11 |
ExcelCell
data | The data that will be added to the cell. | |
styleIdstring | The ExcelStyle id to be associated with the cell. | |
mergeAcrossnumber | The number of cells to span across (1 means span 2 columns) Default: 0 |
ExcelData
type * | The type of data being in the cell. | |
value *string | The value of the cell. |
ExcelImage
id *string | The image id. This field is required so the same image doesn't get imported multiple times. | |
base64 *string | A base64 string that represents the image being imported. See more info about Base64/ | |
imageType *string | The type of image being exported. Options: 'jpg', 'png', 'gif' | |
fitCellboolean | If set to true, the image will cover the whole cell that is being imported to.Default: false | |
transparencynumber | Set a value between 0 - 100 that will indicate the percentage of transparency of the image. Default: 0 | |
rotationnumber | Set a value between 0 - 359 that will indicate the number of degrees to rotate the image clockwise. Default: 0 | |
recolorstring | Set this property to select a preset that changes the appearance of the image. Options: 'Grayscale', 'Sepia', 'Washout' | |
widthnumber | The width of the image in pixels. If this value is not selected, fitCell will be automatically set to true. | |
heightnumber | The height of the image in pixels. If this value is not selected, fitCell will be automatically set to true. | |
position | See position for more details. |
position
excelImage > position
rownumber | The row containing this image. This property is set automatically, don't change it unless you know what you are doing. | |
rowSpannumber | The amount of rows this image will cover. Default: 1 | |
columnnumber | The column containing this image. This property is set automatically, don't change it unless you know what you are doing. | |
colSpannumber | The amount of columns this image will cover. Default: 1 | |
offsetXnumber | The amount in pixels the image should be offset horizontally. Default: 0 | |
offsetYnumber | The amount in pixels the image should be offset vertically. Default: 0 |
ExcelStyle
id *string | The id of the Excel Style, this should match a CSS cell class. | |
alignment | Use this property to customise cell alignment properties. | |
borders | Use this property to customise cell borders. | |
dataType | Use this property to specify the type of data being exported. Default: 'String' | |
font | Use this property to customise the font used in the cell. | |
interior | Use this property to customise the cell background. | |
numberFormat | Use this property to customise the cell value as a formatted number. | |
protection | Use this property to setup cell protection. |
ExcelAlignment
horizontalstring | Use this property to change the cell horizontal alignment. Default: 'Automatic'Options: 'Automatic', 'Left', 'Center', 'Right', 'Fill', 'Justify', 'CenterAcrossSelection', 'Distributed', 'JustifyDistributed' | |
indentnumber | Use this property to change the level of indentation in the cell. Default: 0 | |
readingOrderstring | Use this property to change the cell reading order. Default: 'LeftToRight'Options: 'RightToLeft', 'LeftToRight', 'Context' | |
rotatenumber | The number of degrees between 0 and 359 to rotate the text. Default: 0 | |
shrinkToFitboolean | If set to true, the font size of the cell will automatically change to force the text to fit within the cell.Default: false | |
verticalstring | Use this property to change the cell vertical alignment. Default: 'Automatic'Options: 'Automatic', 'Top', 'Bottom', 'Center', 'Justify', 'Distributed', 'JustifyDistributed' | |
wrapTextboolean | If set to true, multiline text will be displayed as multiline by Excel.Default: false |
ExcelBorders
borderBottom | Use to set the cell's bottom border. | |
borderLeft | Use to set the cell's left border. | |
borderRight | Use to set the cell's right border. | |
borderTop | Use to set the cell's top border. |
ExcelBorder
colorstring | The color of the border. Default: 'black' | |
lineStylestring | The style of the border. Default: 'None'Options: 'None', 'Continuous', 'Dash', 'Dot', 'DashDot', 'DashDotDot', 'SlantDashDot', 'Double' | |
weightnumber | The thickness of the border from 0 (thin) to 3 (thick) Default: 0Options: 0, 1, 2, 3 |
ExcelFont
boldboolean | Set to true to set the cell text to bold.Default: false | |
colorstring | The color of the cell font. Default: '#000000' | |
familystring | The family of the font to used in the cell. Default: 'Automatic'Options: 'Automatic', 'Roman', 'Swiss', 'Modern', 'Script', 'Decorative' | |
fontNamestring | The name of the font to be used in the cell. Default: 'Calibri' | |
italicboolean | Set to true to display the cell font as italic.Default: false | |
outlineboolean | Set to true to add a text outline.Default: false | |
shadowboolean | Set to true to add text shadow.Default: false | |
sizenumber | Set this property to used a different font size other than the default. | |
strikeThroughboolean | Set to true to add a strikeThrough line.Default: false | |
underlinestring | Use this property to underline the cell text. Options: 'Single', 'Double' | |
verticalAlignstring | Use this property to change the default font alignment. Note: This is different than setting cell vertical alignment. Options: 'Superscript', 'Subscript' |
ExcelInterior
colorstring | The colour of the cell background. | |
patternstring | Use this property to set background color patterns. Default: 'None'Options: 'None', 'Solid', 'Gray75', 'Gray50', 'Gray25', 'Gray125', 'Gray0625', 'HorzStripe', 'VertStripe', 'ReverseDiagStripe', 'DiagStripe', 'DiagCross', 'ThickDiagCross', 'ThinHorzStripe', 'ThinVertStripe', 'ThinReverseDiagStripe', 'ThinDiagStripe', 'ThinHorzCross', 'ThinDiagCross' | |
patternColorstring | The colour to be used as a secondary colour combined with patterns. |
ExcelNumberFormat
formatstring | Use this property to provide a pattern to format a number. (eg. 10000 could become $10,000.00). |
ExcelProtection
protectedboolean | Set to false to disable cell protection (locking)Default: true | |
hideFormulaboolean | Set to true to hide formulas within protected cellsDefault: false |
ExcelSheetMargin
topnumber | The sheet top margin. Default: 0.75 | |
rightnumber | The sheet right margin. Default: 0.7 | |
bottomnumber | The sheet bottom margin. Default: 0.75 | |
leftnumber | The sheet left margin. Default: 0.7 | |
headernumber | The sheet header margin. Default: 0.3 | |
footernumber | The sheet footer margin. Default: 0.3 |
ExcelSheetPageSetup
orientationstring | Use this property to change the print orientation. Default: 'Portrait'Options: 'Portrait', 'Landscape' | |
pageSizestring | Use this property to set the sheet size. Default: 'Letter'Options: 'Letter', 'Letter Small', 'Tabloid', 'Ledger', 'Legal', 'Statement', 'Executive', 'A3', 'A4', 'A4 Small', 'A5', 'A6', 'B4', 'B5', 'Folio', 'Envelope', 'Envelope DL', 'Envelope C5', 'Envelope B5', 'Envelope C3', 'Envelope C4', 'Envelope C6', 'Envelope Monarch', 'Japanese Postcard', 'Japanese Double Postcard' |
ExcelHeaderFooterConfig
all | The configuration for header and footer on every page. | |
first | The configuration for header and footer on the first page only. | |
even | The configuration for header and footer on even numbered pages only.. |
ExcelHeaderFooter
header | An array of maximum 3 items (Left, Center, Right), containing header configurations. | |
footer | An array of maximum 3 items (Left, Center, Right), containing footer configurations. |
ExcelHeaderFooterContent
value *string | The value of the text to be included in the header. | |
positionstring | Configures where the text should be added (Left, Center, Right) Default: 'Left'Options: 'Left', 'Center', 'Right' | |
font | The font style of the header/footer value. |
Types
ExcelDataType
type ExcelDataType = 'String' | 'Formula' | 'Number' | 'Boolean' | 'DateTime' | 'Error'ExcelOOXMLDataType
type ExcelOOXMLDataType = 'str' | 's' | 'f' | 'inlineStr' | 'n' | 'b' | 'd' | 'e' | 'empty'- Excel Export API Reference
- Grid Properties
- API Methods
- Interfaces
- ExcelExportParams:
- ExcelExportMultipleSheetParams:
- ExcelCell
- ExcelData
- ExcelImage
- ExcelStyle
- ExcelAlignment
- ExcelBorders
- ExcelBorder
- ExcelFont
- ExcelInterior
- ExcelNumberFormat
- ExcelProtection
- ExcelSheetMargin
- ExcelSheetPageSetup
- ExcelHeaderFooterConfig
- ExcelHeaderFooter
- ExcelHeaderFooterContent
- Types
- ExcelDataType
- ExcelOOXMLDataType