How to create and write an excel spreadsheet playing with different attributes like font, color, format, highlight, etc?.


Here are the steps to compile and run the attached sample COBOL program (in xlsx.zip) which will create an Excel spreadsheet and change the format, font, color and highlight some of the cells. This sample uses Apache POI based on the POI API documentation
In order to modify this sample program, we recommend to use the IDE due to the fact it is easier to build a source program that uses external java libraries, since isCOBOL IDE Editor allows to get the name/fields methods of the class/object reference thanks to the "Content Assistant" facility.

1. Extract the attached zip file, xlsx.zip, into a directory
2. Import the project to the IDE
3. The project contains the sample program called xlsx.cbl
4. Compile and execute the program XLSX.cbl, after the execution you will find an Excel spreadsheet called excel-file.xlsx in the output folder of the project.

From the command line, you just need to compile with iscc xlsx.cbl and execute it with iscrun XLSX.class.

This sample program can be compiled and executed from the command from 2016R1 version; earlier versions require POI libraries to be installed separately.



Article ID: 289
Created: December 12, 2017
Last Updated: December 12, 2017
Author: Support KB Author

Online URL: https://support.veryant.com/support/phpkb/article.php?id=289