ExcelDocument data type

Official Content
This documentation is valid for:

Unifies interaction with the generation of Microsoft Excel documents for the different languages generated. It allows you to generate and handle Microsoft Excel worksheets. In addition, the ExcelCells data type is implemented internally and is used to handle the group of cells contained in the worksheet.

An important advantage of this implementation over the previous ones is that spreadsheets are handled with an object-oriented model and it is no longer necessary to control Handles.

Properties

Methods

Scope

Languages: .NET, Java

Examples

Event "Excel"
   &ExcelDocument.Open(&FileName)  

   If &ExcelDocument.ErrCode <> 0 
       msg(&ExcelDocument.ErrDescription) 
   Else 
       &ExcelDocument.Clear()  
    
       &ExcelDocument.Cells(1,1).Text = 'Customers list'  
       &ExcelDocument.Cells(1,1).Bold = 1 
       &ExcelDocument.Cells(1,1).Color = RGB(0, 0, 255) 
       &ExcelDocument.Cells(1,1).Size = 10 
        
       &ExcelDocument.Cells(3,1).Text = 'Customer Id' 
       &ExcelDocument.Cells(3,1).Italic = 1 
       &ExcelDocument.Cells(3,1).Bold = 1 
    
       &row = 4 
       &col = 1 
       For Each Line in Grid 
    
               &ExcelDocument.Cells(&row,&col).Number = CustomerId 
               &ExcelDocument.Cells(&row,&col).Color = RGB(0, 0, 255) 
               &row += 1    
              
       Endfor  
       &ExcelDocument.Save()  
   Endif
EndEvent 

.NET

There are two possible implementations:

  • EPPLUS: GeneXus uses this implementation when .xlsx file extension is configured (which is advisable). Click here for more information.
  • ExcelLite DLL: GeneXus uses this implementation when the necessary file - GemBox.Spreadsheet.dll - is available after installing GemBox's spreadsheet software.

Note: The only way to generate the proprietary .xls files is using ExcelLite.

Java

Click here for more information.

Managing excel documents common issues

See also

ExcelCells data type