React Common - Object Structures - PdfCell - padding

Specifies the top, bottom, left, and right paddings of the DataGrid cell.

Type:

Object

Uses the measure units which are specified in the constructor of the jsPDFDocument object.

App.js
  • import React from 'react';
  • import 'devextreme/dist/css/dx.light.css';
  •  
  • import DataGrid from 'devextreme-react/data-grid';
  • import Button from 'devextreme-react/button';
  • import { jsPDF } from 'jspdf';
  • import { exportDataGrid as exportDataGridToPdf } from 'devextreme/pdf_exporter';
  •  
  • const App = () => {
  • const dataGridRef = useRef(null);
  •  
  • function exportGrid() {
  • const doc = new jsPDF();
  • const dataGrid = dataGridRef.current.instance();
  •  
  • exportDataGridToPdf({
  • jsPDFDocument: doc,
  • component: dataGrid,
  • customizeCell: function(options) {
  • const { gridCell, pdfCell } = options;
  •  
  • if(gridCell.rowType === 'data') {
  • pdfCell.padding = { top: 10, right: 10, bottom: 10, left: 10 };
  • }
  • }
  • }).then(() => {
  • doc.save('Customers.pdf');
  • });
  • }
  •  
  • return (
  • <React.Fragment>
  • <Button ...
  • onClick={exportGrid}
  • />
  • <DataGrid ...
  • ref={dataGridRef}>
  • {/* ... */}
  • </DataGrid>
  • </React.Fragment>
  • );
  • }
  •  
  • export default App;

bottom

Specifies the bottom padding of the DataGrid cell.

Type:

Number

left

Specifies the left padding of the DataGrid cell.

Type:

Number

right

Specifies the right padding of the DataGrid cell.

Type:

Number

top

Specifies the top padding of the DataGrid cell.

Type:

Number