Framework:Javascript Data GridAngular Data GridReact Data GridVue Data Grid

Angular Data Grid: Excel Export API Reference

This page documents the Excel Export API and Interfaces.

Grid Properties

defaultExcelExportParams
A default configuration object used to export to Excel.
suppressExcelExport
boolean
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.
excelStyles: ExcelStyle[];

interface ExcelStyle {
  // The id of the Excel Style, this should match a CSS cell class. 
  id: string;
  // Use this property to customise cell alignment properties. 
  alignment?: ExcelAlignment;
  // Use this property to customise cell borders. 
  borders?: ExcelBorders;
  // Use this property to specify the type of data being exported. 
  dataType?: ExcelDataType;
  // Use this property to customise the font used in the cell. 
  font?: ExcelFont;
  // Use this property to customise the cell background. 
  interior?: ExcelInterior;
  // Use this property to customise the cell value as a formatted number. 
  numberFormat?: ExcelNumberFormat;
  // Use this property to setup cell protection. 
  protection?: ExcelProtection;
}

API Methods

exportDataAsExcel
Function
Downloads an Excel export of the grid's data.
function exportDataAsExcel(
    params?: ExcelExportParams
): void;
getDataAsExcel
Similar to exportDataAsExcel, except instead of downloading a file, it will return a Blob to be processed by the user.
function getDataAsExcel(
    params?: ExcelExportParams
): string | Blob | undefined;
getSheetDataForExcel
Function
This is method to be used to get the grid's data as a sheet, that will later be exported either by getMultipleSheetsAsExcel() or exportMultipleSheetsAsExcel().
function getSheetDataForExcel(
    params?: ExcelExportParams
): string | undefined;
exportMultipleSheetsAsExcel
Function
Downloads an Excel export of multiple sheets in one file.
function exportMultipleSheetsAsExcel(
    params: ExcelExportMultipleSheetParams
): void;

interface ExcelExportMultipleSheetParams {
  // The author of the exported file.
  // Default: `AG Grid` 
  author?: string;
  // 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()`. 
  data: string[];
  // String to use as the file name.
  // Default: `export.xlsx` 
  fileName?: string;
  // The default value for the font size of the Excel document.
  // Default: `11` 
  fontSize?: number;
  // The mimeType of the Excel file.
  // Default: `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet` 
  mimeType?: string;
}
getMultipleSheetsAsExcel
Similar to exportMultipleSheetsAsExcel, except instead of downloading a file, it will return a Blob to be processed by the user.
function getMultipleSheetsAsExcel(
    params: ExcelExportMultipleSheetParams
): Blob | undefined;

interface ExcelExportMultipleSheetParams {
  // The author of the exported file.
  // Default: `AG Grid` 
  author?: string;
  // 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()`. 
  data: string[];
  // String to use as the file name.
  // Default: `export.xlsx` 
  fileName?: string;
  // The default value for the font size of the Excel document.
  // Default: `11` 
  fontSize?: number;
  // The mimeType of the Excel file.
  // Default: `application/vnd.openxmlformats-officedocument.spreadsheetml.sheet` 
  mimeType?: string;
}

Interfaces

ExcelExportParams

Properties available on the ExcelExportParams interface.

author
string
The author of the exported file.
Default: "AG Grid"
autoConvertFormulas
boolean
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
columnWidth
number | ((params: ColumnWidthCallbackParams) => number)
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.
columnWidth: number | ((params: ColumnWidthCallbackParams) => number);

interface ColumnWidthCallbackParams {
  column: Column | null;
  index: number;
}
exportMode
'xlsx' | 'xml'
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
fontSize
number
The default value for the font size of the Excel document.
Default: 11
headerRowHeight
number | ((params: RowHeightCallbackParams) => number)
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.
headerRowHeight: number | ((params: RowHeightCallbackParams) => number);

interface RowHeightCallbackParams {
  rowIndex: number;
}
rowHeight
number | ((params: RowHeightCallbackParams) => number)
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.
rowHeight: number | ((params: RowHeightCallbackParams) => number);

interface RowHeightCallbackParams {
  rowIndex: number;
}
sheetName
string
The name of the sheet in Excel where the grid will be exported. There is a max limit of 31 characters.
Default: ag-grid
margins
The Excel document page margins. Relevant for printing.
margins: ExcelSheetMargin;

interface ExcelSheetMargin {
  // The sheet top margin.
  // Default: `0.75` 
  top?: number;
  // The sheet right margin.
  // Default: `0.7` 
  right?: number;
  // The sheet bottom margin.
  // Default: `0.75` 
  bottom?: number;
  // The sheet left margin.
  // Default: `0.7` 
  left?: number;
  // The sheet header margin.
  // Default: `0.3` 
  header?: number;
  // The sheet footer margin.
  // Default: `0.3` 
  footer?: number;
}
pageSetup
Allows you to setup the page orientation and size.
pageSetup: ExcelSheetPageSetup;

interface ExcelSheetPageSetup {
  // Use this property to change the print orientation.
  // Default: `Portrait` 
  orientation?: 'Portrait' | 'Landscape';
  // Use this property to set the sheet size.
  // Default: `Letter` 
  pageSize?: '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';
}
headerFooterConfig
ExcelHeaderFooterConfig
The configuration for header and footers.
headerFooterConfig: ExcelHeaderFooterConfig;

interface ExcelHeaderFooterConfig {
  // The configuration for header and footer on every page. 
  all?: ExcelHeaderFooter;
  // The configuration for header and footer on the first page only. 
  first?: ExcelHeaderFooter;
  // The configuration for header and footer on even numbered pages only. 
  even?: ExcelHeaderFooter;
}
suppressTextAsCDATA
boolean
If true, text content will be encoded with XML character entities like < and >. This is only relevant when exportMode='xml'.
Default: false
mimeType
string
The mimeType of the Excel file. Note that this defaults to application/vnd.ms-excel if exportMode is xml.
Default: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
addImageToCell
Function
Use to export an image for the gridCell in question.
addImageToCell = (
    rowIndex: number,
    column: Column,
    value: string
) => { image: ExcelImage; value?: string; } | undefined;

interface ExcelImage {
  // The image `id`. This field is required so the same image doesn't get imported multiple times. 
  id: string;
  // A base64 string that represents the image being imported. 
  base64: string;
  // The type of image being exported. 
  imageType: 'jpg' | 'png' | 'gif';
  // Alt Text for the image. 
  altText?: string;
  // If set to `true`, the image will cover the whole cell that is being imported to.
  // Default: `false` 
  fitCell?: boolean;
  // Set a value between 0 - 100 that will indicate the percentage of transparency of the image.
  // Default: `0` 
  transparency?: number;
  // Set a value between 0 - 359 that will indicate the number of degrees to rotate the image clockwise.
  // Default: `0` 
  rotation?: number;
  // Set this property to select a preset that changes the appearance of the image. 
  recolor?: 'Grayscale' | 'Sepia' | 'Washout';
  // The width of the image in pixels. If this value is not selected, `fitCell` will be automatically set to true. 
  width?: number;
  // The height of the image in pixels. If this value is not selected, `fitCell` will be automatically set to true. 
  height?: number;
  // Position of the image. 
  position?: ExcelImagePosition;
}
prependContent
ExcelRow[]
Content to put at the bottom of the exported sheet. An array of ExcelRow objects, see Extra Content section.
prependContent: ExcelRow[];

interface ExcelRow {
  // Collapsed state. 
  collapsed?: boolean;
  // Hidden state. 
  hidden?: boolean;
  // The height of the row. 
  height?: number;
  // The indentation level if the current row is part of a row group. 
  outlineLevel?: number;
  // An array of ExcelCells. 
  cells: ExcelCell[];
}
appendContent
ExcelRow[]
Content to put at the top of the exported sheet. An array of ExcelRow objects, see Extra Content section.
appendContent: ExcelRow[];

interface ExcelRow {
  // Collapsed state. 
  collapsed?: boolean;
  // Hidden state. 
  hidden?: boolean;
  // The height of the row. 
  height?: number;
  // The indentation level if the current row is part of a row group. 
  outlineLevel?: number;
  // An array of ExcelCells. 
  cells: ExcelCell[];
}
getCustomContentBelowRow
Function
A callback function to return content to be inserted below a row in the export.
getCustomContentBelowRow = (
    params: ProcessRowGroupForExportParams
) => ExcelRow[] | undefined;

interface ProcessRowGroupForExportParams<TData = any> {
  // Row node. 
  node: RowNode<TData>;
  // The grid api. 
  api: GridApi<TData>;
  // The column api. 
  columnApi: ColumnApi;
  // Application context as set on `gridOptions.context`. 
  context: any;
}

interface ExcelRow {
  // Collapsed state. 
  collapsed?: boolean;
  // Hidden state. 
  hidden?: boolean;
  // The height of the row. 
  height?: number;
  // The indentation level if the current row is part of a row group. 
  outlineLevel?: number;
  // An array of ExcelCells. 
  cells: ExcelCell[];
}
allColumns
boolean
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.
rowPositions
RowPosition[]
Row node positions.
rowPositions: RowPosition[];

interface RowPosition {
  // A positive number from 0 to n, where n is the last row the grid is rendering
  // or -1 if you want to navigate to the grid header 
  rowIndex: number;
  // Either 'top', 'bottom' or null/undefined (for not pinned) 
  rowPinned: RowPinnedType;
}

type RowPinnedType = 
      'top' 
    | 'bottom' 
    | null 
    | undefined
fileName
string
String to use as the file name.
Default: 'export.xlsx'
exportedRows
'all' | 'filteredAndSorted'
Determines whether rows are exported before being filtered and sorted.
Default: filteredAndSorted
onlySelected
boolean
Export only selected rows.
Default: false
onlySelectedAllPages
boolean
Only export selected rows including other pages (only makes sense when using pagination).
Default: false
skipColumnGroupHeaders
boolean
Set to true to exclude header column groups.
Default: false
skipColumnHeaders
boolean
Set to true if you don't want to export column headers.
Default: false
skipRowGroups
boolean
Set to true to skip row group headers if grouping rows. Only relevant when grouping rows.
Default: false
skipPinnedTop
boolean
Set to true to suppress exporting rows pinned to the top of the grid.
Default: false
skipPinnedBottom
boolean
Set to true to suppress exporting rows pinned to the bottom of the grid.
Default: false
shouldRowBeSkipped
Function
A callback function that will be invoked once per row in the grid. Return true to omit the row from the export.
shouldRowBeSkipped = (
    params: ShouldRowBeSkippedParams
) => boolean;

interface ShouldRowBeSkippedParams<TData = any> {
  // Row node. 
  node: RowNode<TData>;
  // The grid api. 
  api: GridApi<TData>;
  // The column api. 
  columnApi: ColumnApi;
  // Application context as set on `gridOptions.context`. 
  context: any;
}
processCellCallback
Function
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.
processCellCallback = (
    params: ProcessCellForExportParams
) => string;

interface ProcessCellForExportParams<TData = any> {
  value: any;
  accumulatedRowIndex?: number;
  node?: RowNode<TData> | null;
  column: Column;
  type: string;
  // The grid api. 
  api: GridApi<TData>;
  // The column api. 
  columnApi: ColumnApi;
  // Application context as set on `gridOptions.context`. 
  context: any;
}
processHeaderCallback
Function
A callback function invoked once per column. Return a string to be displayed in the column header.
processHeaderCallback = (
    params: ProcessHeaderForExportParams
) => string;

interface ProcessHeaderForExportParams<TData = any> {
  column: Column;
  // The grid api. 
  api: GridApi<TData>;
  // The column api. 
  columnApi: ColumnApi;
  // Application context as set on `gridOptions.context`. 
  context: any;
}
processGroupHeaderCallback
Function
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.
processGroupHeaderCallback = (
    params: ProcessGroupHeaderForExportParams
) => string;

interface ProcessGroupHeaderForExportParams<TData = any> {
  columnGroup: ColumnGroup;
  // The grid api. 
  api: GridApi<TData>;
  // The column api. 
  columnApi: ColumnApi;
  // Application context as set on `gridOptions.context`. 
  context: any;
}
processRowGroupCallback
Function
A callback function invoked once per row group. Return a string to be displayed in the group cell.
processRowGroupCallback = (
    params: ProcessRowGroupForExportParams
) => string;

interface ProcessRowGroupForExportParams<TData = any> {
  // Row node. 
  node: RowNode<TData>;
  // The grid api. 
  api: GridApi<TData>;
  // The column api. 
  columnApi: ColumnApi;
  // Application context as set on `gridOptions.context`. 
  context: any;
}

ExcelExportMultipleSheetParams

Properties available on the ExcelExportMultipleSheetParams interface.

See Multiple Sheets for more information.

author
string
The author of the exported file.
Default: AG Grid
data
string[]
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().
fileName
string
String to use as the file name.
Default: export.xlsx
fontSize
number
The default value for the font size of the Excel document.
Default: 11
mimeType
string
The mimeType of the Excel file.
Default: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

ExcelAlignment

Properties available on the ExcelAlignment interface.

horizontal
'Automatic' | 'Left' | 'Center' | 'Right' | 'Fill' | 'Justify' | 'CenterAcrossSelection' | 'Distributed' | 'JustifyDistributed'
Use this property to change the cell horizontal alignment.
Default: Automatic
indent
number
Use this property to change the level of indentation in the cell.
Default: 0
readingOrder
'RightToLeft' | 'LeftToRight' | 'Context'
Use this property to change the cell reading order.
Default: LeftToRight
rotate
number
The number of degrees between 0 and 359 to rotate the text.
Default: 0
shrinkToFit
boolean
If set to true, the font size of the cell will automatically change to force the text to fit within the cell.
Default: false
vertical
'Automatic' | 'Top' | 'Bottom' | 'Center' | 'Justify' | 'Distributed' | 'JustifyDistributed'
Use this property to change the cell vertical alignment.
Default: Automatic
wrapText
boolean
If set to true, multiline text will be displayed as multiline by Excel.
Default: false

ExcelBorders

Properties available on the ExcelBorders interface.

borderBottom
Use to set the cell's bottom border.
borderBottom: ExcelBorder;

interface ExcelBorder {
  // The color or the border.
  // Default: `black` 
  color?: string;
  // The style of the border.
  // Default: `None` 
  lineStyle?: 'None' | 'Continuous' | 'Dash' | 'Dot' | 'DashDot' | 'DashDotDot' | 'SlantDashDot' | 'Double';
  // The thickness of the border from 0 (thin) to 3 (thick).
  // Default: `0` 
  weight?: 0 | 1 | 2 | 3;
}
borderLeft
Use to set the cell's left border.
borderLeft: ExcelBorder;

interface ExcelBorder {
  // The color or the border.
  // Default: `black` 
  color?: string;
  // The style of the border.
  // Default: `None` 
  lineStyle?: 'None' | 'Continuous' | 'Dash' | 'Dot' | 'DashDot' | 'DashDotDot' | 'SlantDashDot' | 'Double';
  // The thickness of the border from 0 (thin) to 3 (thick).
  // Default: `0` 
  weight?: 0 | 1 | 2 | 3;
}
borderRight
Use to set the cell's right border.
borderRight: ExcelBorder;

interface ExcelBorder {
  // The color or the border.
  // Default: `black` 
  color?: string;
  // The style of the border.
  // Default: `None` 
  lineStyle?: 'None' | 'Continuous' | 'Dash' | 'Dot' | 'DashDot' | 'DashDotDot' | 'SlantDashDot' | 'Double';
  // The thickness of the border from 0 (thin) to 3 (thick).
  // Default: `0` 
  weight?: 0 | 1 | 2 | 3;
}
borderTop
Use to set the cell's top border.
borderTop: ExcelBorder;

interface ExcelBorder {
  // The color or the border.
  // Default: `black` 
  color?: string;
  // The style of the border.
  // Default: `None` 
  lineStyle?: 'None' | 'Continuous' | 'Dash' | 'Dot' | 'DashDot' | 'DashDotDot' | 'SlantDashDot' | 'Double';
  // The thickness of the border from 0 (thin) to 3 (thick).
  // Default: `0` 
  weight?: 0 | 1 | 2 | 3;
}

ExcelBorder

Properties available on the ExcelBorder interface.

color
string
The color or the border.
Default: black
lineStyle
'None' | 'Continuous' | 'Dash' | 'Dot' | 'DashDot' | 'DashDotDot' | 'SlantDashDot' | 'Double'
The style of the border.
Default: None
weight
0 | 1 | 2 | 3
The thickness of the border from 0 (thin) to 3 (thick).
Default: 0

ExcelCell

Properties available on the ExcelCell interface.

ref
string
Cell reference.
styleId
string
The ExcelStyle id to be associated with the cell.
data
The data that will be added to the cell.
data: ExcelData;

interface ExcelData {
  // The type of data being in the cell. 
  type: ExcelDataType | ExcelOOXMLDataType;
  // The value of the cell. 
  value: string | null;
}
mergeAcross
number
The number of cells to span across (1 means span 2 columns).
Default: 0
collapsibleRanges
number[][]
Collapsible ranges.

ExcelData

Properties available on the ExcelData interface.

type *
ExcelDataType | ExcelOOXMLDataType
The type of data being in the cell.
type: ExcelDataType | ExcelOOXMLDataType;

type ExcelDataType = 
      'String' 
    | 'Formula' 
    | 'Number' 
    | 'Boolean' 
    | 'DateTime' 
    | 'Error'


type ExcelOOXMLDataType = 
      'str' 
    | 's' 
    | 'f' 
    | 'inlineStr' 
    | 'n' 
    | 'b' 
    | 'd' 
    | 'e' 
    | 'empty'
value *
string | null
The value of the cell.

ExcelFont

Properties available on the ExcelFont interface.

bold
boolean
Set to true to set the cell text to bold.
Default: false
color
string
The color of the cell font.
Default: #000000
family
string
The family of the font to used in the cell. Options: Automatic,Roman,Swiss,Modern,Script,Decorative,
Default: Automatic
fontName
string
The name of the font to be used in the cell.
Default: Calibri
italic
boolean
Set to true to display the cell font as italic.
Default: false
outline
boolean
Set to true to add a text outline.
Default: false
shadow
boolean
Set to true to add text shadow.
Default: false
size
number
Set this property to used a different font size other than the default.
strikeThrough
boolean
Set to true to add a strikeThrough line.
Default: false
underline
'Single' | 'Double'
Use this property to underline the cell text.
verticalAlign
'Superscript' | 'Subscript'
Use this property to change the default font alignment. Note: This is different than setting cell vertical alignment.

ExcelHeaderFooter

Properties available on the ExcelHeaderFooter interface.

header
ExcelHeaderFooterContent[]
An array of maximum 3 items (Left, Center, Right), containing header configurations.
header: ExcelHeaderFooterContent[];

interface ExcelHeaderFooterContent {
  // The value of the text to be included in the header. 
  value: string;
  // Configures where the text should be added: `Left`, `Center` or `Right`.
  // Default: `Left` 
  position?: 'Left' | 'Center' | 'Right';
  // The font style of the header/footer value. 
  font?: ExcelFont;
}
ExcelHeaderFooterContent[]
An array of maximum 3 items (Left, Center, Right), containing footer configurations.
footer: ExcelHeaderFooterContent[];

interface ExcelHeaderFooterContent {
  // The value of the text to be included in the header. 
  value: string;
  // Configures where the text should be added: `Left`, `Center` or `Right`.
  // Default: `Left` 
  position?: 'Left' | 'Center' | 'Right';
  // The font style of the header/footer value. 
  font?: ExcelFont;
}

ExcelHeaderFooterContent

Properties available on the ExcelHeaderFooterContent interface.

value *
string
The value of the text to be included in the header.
position
'Left' | 'Center' | 'Right'
Configures where the text should be added: Left, Center or Right.
Default: Left
font
The font style of the header/footer value.

ExcelImage

Properties available on the ExcelImage interface.

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 Base64.
imageType *
'jpg' | 'png' | 'gif'
The type of image being exported.
altText
string
Alt Text for the image.
fitCell
boolean
If set to true, the image will cover the whole cell that is being imported to.
Default: false
transparency
number
Set a value between 0 - 100 that will indicate the percentage of transparency of the image.
Default: 0
rotation
number
Set a value between 0 - 359 that will indicate the number of degrees to rotate the image clockwise.
Default: 0
recolor
'Grayscale' | 'Sepia' | 'Washout'
Set this property to select a preset that changes the appearance of the image.
width
number
The width of the image in pixels. If this value is not selected, fitCell will be automatically set to true.
height
number
The height of the image in pixels. If this value is not selected, fitCell will be automatically set to true.
position
Position of the image.
position: ExcelImagePosition;

interface ExcelImagePosition {
  // The row containing this image. This property is set automatically, don't change it unless you know what you are doing. 
  row?: number;
  // The amount of rows this image will cover.
  // Default: `1` 
  rowSpan?: number;
  // The column containing this image. This property is set automatically, don't change it unless you know what you are doing. 
  column?: number;
  // The amount of columns this image will cover.
  // Default: `1` 
  colSpan?: number;
  // The amount in pixels the image should be offset horizontally.
  // Default: `0` 
  offsetX?: number;
  // The amount in pixels the image should be offset vertically.
  // Default: `0` 
  offsetY?: number;
}

ExcelImagePosition

Properties available on the ExcelImagePosition interface.

row
number
The row containing this image. This property is set automatically, don't change it unless you know what you are doing.
rowSpan
number
The amount of rows this image will cover.
Default: 1
column
number
The column containing this image. This property is set automatically, don't change it unless you know what you are doing.
colSpan
number
The amount of columns this image will cover.
Default: 1
offsetX
number
The amount in pixels the image should be offset horizontally.
Default: 0
offsetY
number
The amount in pixels the image should be offset vertically.
Default: 0

ExcelInterior

Properties available on the ExcelInterior interface.

pattern
'None' | 'Solid' | 'Gray75' | 'Gray50' | 'Gray25' | 'Gray125' | 'Gray0625' | 'HorzStripe' | 'VertStripe' | 'ReverseDiagStripe' | 'DiagStripe' | 'DiagCross' | 'ThickDiagCross' | 'ThinHorzStripe' | 'ThinVertStripe' | 'ThinReverseDiagStripe' | 'ThinDiagStripe' | 'ThinHorzCross' | 'ThinDiagCross'
Use this property to set background color patterns.
color
string
The colour to be used as a secondary colour combined with patterns.
patternColor
string
The pattern color.

ExcelNumberFormat

Properties available on the ExcelNumberFormat interface.

format
string
Use this property to provide a pattern to format a number. (eg. 10000 could become $10,000.00).

ExcelProtection

Properties available on the ExcelProtection interface.

protected
boolean
Set to false to disable cell protection (locking)
Default: true
hideFormula
boolean
Set to true to hide formulas within protected cells.
Default: false

ExcelSheetMargin

Properties available on the ExcelSheetMargin interface.

top
number
The sheet top margin.
Default: 0.75
right
number
The sheet right margin.
Default: 0.7
bottom
number
The sheet bottom margin.
Default: 0.75
left
number
The sheet left margin.
Default: 0.7
header
number
The sheet header margin.
Default: 0.3
number
The sheet footer margin.
Default: 0.3

ExcelSheetPageSetup

Properties available on the ExcelSheetPageSetup interface.

orientation
'Portrait' | 'Landscape'
Use this property to change the print orientation.
Default: Portrait
pageSize
'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'
Use this property to set the sheet size.
Default: Letter

ExcelStyle

Properties available on the ExcelStyle interface.

id *
string
The id of the Excel Style, this should match a CSS cell class.
alignment
Use this property to customise cell alignment properties.
alignment: ExcelAlignment;

interface ExcelAlignment {
  // Use this property to change the cell horizontal alignment.
  // Default: `Automatic` 
  horizontal?: 'Automatic' | 'Left' | 'Center' | 'Right' | 'Fill' | 'Justify' | 'CenterAcrossSelection' | 'Distributed' | 'JustifyDistributed';
  // Use this property to change the level of indentation in the cell.
  // Default: 0 
  indent?: number;
  // Use this property to change the cell reading order.
  // Default: `LeftToRight` 
  readingOrder?: 'RightToLeft' | 'LeftToRight' | 'Context';
  // The number of degrees between 0 and 359 to rotate the text.
  // Default: `0` 
  rotate?: number;
  // If set to `true`, the font size of the cell will automatically change to force the text to fit within the cell.
  // Default: `false` 
  shrinkToFit?: boolean;
  // Use this property to change the cell vertical alignment.
  // Default: `Automatic` 
  vertical?: 'Automatic' | 'Top' | 'Bottom' | 'Center' | 'Justify' | 'Distributed' | 'JustifyDistributed';
  // If set to `true`, multiline text will be displayed as multiline by Excel.
  // Default: `false` 
  wrapText?: boolean;
}
borders
Use this property to customise cell borders.
borders: ExcelBorders;

interface ExcelBorders {
  // Use to set the cell's bottom border. 
  borderBottom?: ExcelBorder;
  // Use to set the cell's left border. 
  borderLeft?: ExcelBorder;
  // Use to set the cell's right border. 
  borderRight?: ExcelBorder;
  // Use to set the cell's top border. 
  borderTop?: ExcelBorder;
}
dataType
Use this property to specify the type of data being exported.
dataType: ExcelDataType;

type ExcelDataType = 
      'String' 
    | 'Formula' 
    | 'Number' 
    | 'Boolean' 
    | 'DateTime' 
    | 'Error'
font
Use this property to customise the font used in the cell.
interior
Use this property to customise the cell background.
interior: ExcelInterior;

interface ExcelInterior {
  // Use this property to set background color patterns. 
  pattern: 'None' | 'Solid' | 'Gray75' | 'Gray50' | 'Gray25' | 'Gray125' | 'Gray0625' | 'HorzStripe' | 'VertStripe' | 'ReverseDiagStripe' | 'DiagStripe' | 'DiagCross' | 'ThickDiagCross' | 'ThinHorzStripe' | 'ThinVertStripe' | 'ThinReverseDiagStripe' | 'ThinDiagStripe' | 'ThinHorzCross' | 'ThinDiagCross';
  // The colour to be used as a secondary colour combined with patterns. 
  color?: string;
  // The pattern color. 
  patternColor?: string;
}
numberFormat
Use this property to customise the cell value as a formatted number.
numberFormat: ExcelNumberFormat;

interface ExcelNumberFormat {
  // Use this property to provide a pattern to format a number. (eg. 10000 could become $10,000.00). 
  format: string;
}
protection
Use this property to setup cell protection.
protection: ExcelProtection;

interface ExcelProtection {
  // Set to `false` to disable cell protection (locking)
  // Default: `true` 
  protected: boolean;
  // Set to `true` to hide formulas within protected cells.
  // Default: `false` 
  hideFormula: boolean;
}

Types

ExcelDataType

type ExcelDataType = 
    'String'   |
    'Formula'  |
    'Number'   |
    'Boolean'  |
    'DateTime' |
    'Error'

ExcelOOXMLDataType

type ExcelOOXMLDataType = 
    'str'       |
    's'         |
    'f'         |
    'inlineStr' |
    'n'         |
    'b'         |
    'd'         |
    'e'         |
    'empty'