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 is that the spreadsheets are handled with an object-oriented model, and it is not necessary to control Handles.
Generators: .NET, .NET Framework, Java
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
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.
Click here to know the files that you must have in the webapp directory for the generation of Excel spreadsheets with .xlsx extension to work correctly.
Please note that the Java Generator also supports Excel spreadsheets with .xls extension.
Managing Excel documents common issues
ExcelCells data type
GeneXus Office Module