RealGrid2 Guide
Export to Excel 🆕
Adding a title to an Excel document

Add title to Excel document

When downloading an Excel document using the exportGrid() function, you can add a title, subtitle, and footer to the Excel document using the documentTitle, documentSubtitle, and documentTail properties of GridExportOptions.

documentTitle - Title documentSubtitle - Subtitle documentTail - footer The detailed properties of the Title option are as follows.

//*.css
.documentStyle {
   border: 1px solid blue;
   text-align: center;
   font-size: 28px;
   background-color:rgba(231, 134, 77, 0.3);
}
 
.documentSubtitleStyle {
   text-align: right;
   font-size: 18px;
   background-color:rgba(231, 134, 77, 0.3);
}
 
.documentTailStyle {
   text-align: center;
   font-size: 18px;
   background-color:rgba(117, 66, 37, 0.3);
}
 
//index.html
gridView.exportGrid({
   type: 'excel',
   target: 'local',
   documentTitle: { //Title
   message: "Real Grid Title 1",
   visible: true;
   spaceTop: 1,
   spaceBottom: 0;
   height: 60,
   styleName: "documentStyle"
   },
   documentSubtitle: { //Subtitle
   message: "Author: RealGrid\nWritten date: " + new Date().toLocaleDateString().replace(/\./g, '').replace(/\s/g, '-'),
   visible: true;
   height: 60,
   styleName: "documentSubtitleStyle"
   },
   documentTail: { //footer
   message: "Real Grid footer",
   visible: true;
   styleName: "documentTailStyle"
   }
});

The styles format has changed from VisualStyles format in 1.0 to CSS format.
If no style is specified, the text will be displayed in the upper left corner.