Languages: Java, .NET
Disclaimer Word Document data type only applies to Java generator.
The implemented feature consists of generating Excel documents without the need to interact with MS Excel. It's another way to generate Excel files.
Ref.: ExcelDocument data type
If &ExcelDocument.ErrCode <> 0
&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
There are two possible implementations:
- EPPLUS: Genexus uses this implementation when xlsx file extension is configured (which is recommendable). Check 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.
Check here for more information.
Managing excel documents common issues
The implemented feature consists of being able to generate Word documents interacting with OpenOffice instead of MSOffice (32 bit DLL implementation). The advantage is that, in addition to avoiding the need to have MSOffice installed in the server and use only a JRE 32 bit VM, OpenOffice has its server that listens to client orders, therefore it does not need to be in the same server where the application runs.
To use OpenOffice instead of MSOffice, you must do the following:
1. &WordDoc.UseMSOffice = 0 //&WordDoc is WordDocument Type: http://www.gxtechnical.com/gxdlsp/pub/genexus_8.0_help_system/data_types/WordDocument.htm
In order to use this property, set the Standard functions property to "Allow non-standard functions".
2. You have to include the following jar files in the WEB-INF\lib directory of your application in Tomcat:
sandbox.jar (it's not necessary in OpenOffice 3 or higher)
They are under the OpenOffice installation, under program\classes folder.
3. Besides, the OpenOffice server must be operating. It is started as follows (using Command Prompt):
<OOffice_path\program> soffice -accept="socket,host=<ServerName>,port=8100;urp;StarOffice.ServiceManager"
Ref.: WordDocument Data Type