{{ title }}

This sample shows how to use the formatItem callback function to сustomize the appearance of cells. Read More

Export settings can contain user-defined callback function formatItem, which is called for every exported cell just before rendering on the document canvas:

wijmo.grid.pdf.FlexGridPdfConverter.export($scope.ctx.grid, 'FlexGrid.pdf', {
    formatItem: function (args) {
        // ...
    }
});

Using this function the user can alter the appearance (such as background color, fore color, font) and content of the cell.

Function takes an argument of PdfFormatItemEventArgs type, which is derived from wijmo.grid.CellRangeEventArgs class and has following members (look into documentation for the full list):

The getFormattedCell function is useful if IFlexGridDrawSettings.customCellContent is set to false (so the cell property will be null), but the user needs to retrive the DOM element that represents the grid cell being rendered.

Initially, the args.data and args.style properties contain different values, depending on IFlexGridDrawSettings.customCellContent property value:

User can change args.data and args.style, these changes will be reflected upon cell rendering.

In this sample the current row number is added to the row header cell via changing the args.data property. The background of a cell of the "Color" column is changed according to its value via changing the args.style.backgroundColor.