Skip to Content

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

Estimated Reading Time: 1 Minutes

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.

How to create and write an excel spreadsheet playing with different attributes like font, color, format, highlight, etc?.
  • Attached Files
  • xlsx.zip (4.47 KB) 18