RealGrid2 Guide
Export to Excel 🆕
Export grid consisting of multiple layouts

layout export

Convert the dataset to an Excel file according to the column structure displayed in the current grid and save it as a local file or upload it to the server.

Excel export

Exports the appearance and data of the current grid to an external document according to the settings specified with the exportGrid() function.

Specify whether to include the area in the document.

  • default - Prints as is currently displayed in the grid.
  • visible - The output includes the relevant area unconditionally.
  • hidden - Do not include unconditionally. In the GridExportOptions API document, you can check the setting model specified when exporting the grid displayed on the screen to an external document such as Excel.
//layout settings
layout1 = [
   {
     name: "companyGroup",
     direction: "horizontal",
     items: [
       "Country",
       "CompanyName"
     ],
     header: {
       text: "Company",
     }
   },
   "OrderID",
   "CustomerID",
   "EmployeeID",
   "OrderDate",
   "Phone"
]
 
layout2 = [
   "OrderID",
   {
     column: "CustomerID",
     width: 200
   },
   {
     name: "companyGroup",
     direction: "horizontal",
     items: [
       "Country",
       "CompanyName"
     ],
     header: {
       text: "Company"
     }
   },
   {
     column: "EmployeeID"
   },
   "OrderDate",
   "Phone"
]
 
layout3 = [
   "OrderID",
   "CustomerID",
   {
     name: "companyGroup",
     direction: "vertical",
     width: 250,
     items: [
       "Country",
       "CompanyName"
     ],
     header: {
       text: "Company"
     }
   },
   "EmployeeID",
   "OrderDate",
   "Phone"
];
 
   //export settings
   var excelType = Boolean(document.querySelector('input[name="excelType"]:checked').value);
   var showProgress = document.getElementById("chkShowProgress").checked;
   var indicator = document.querySelector('input[name="indicator"]:checked').value;
   var header = document.querySelector('input[name="header"]:checked').value;
   var footer = document.querySelector('input[name="footer"]:checked').value;
 
   gridView.exportGrid({
       type: "excel",
       target: "local",
       fileName: "gridExportSample.xlsx",
       showProgress: showProgress,
       progressMessage: "Exporting to Excel.",
       indicator: indicator,
       header: header,
       footer: footer,
       compatibility: excelType,
       done: function () { //Function to be executed after export is complete
           alert("done excel export")
       }
   });