...

 

 SCREEN SECTION.

 

 ...

 

 05  label

     title "Editable Grid"

     line 7 col 31

     size 24 cells

     .

 05  gd1 grid

     line 9 col 31

     size 24  lines 5

     column-headings

     centered-headings

     heading-color 257

     heading-menu-popup 1

     editor-show-always   (1, 1, 1)

     data-columns (1, 3, 5)

     display-columns (1, 7, 15)

     alignment ("C", "R", "L")

     divider-color 8

     use-tab

     .

 05  push-button

     title "Export to Excel"

     line 18 col 32

     size 20

     exception-value 601

     .

 05  label

     title "Read-only Grid "

     line 7 col 62

     size 14 cells

     .

 05  gd2 grid

     line 9 col 62

     size 25  lines 5

     column-headings

     centered-headings

     heading-menu-popup 1

     heading-color 257

     data-columns (1, 3, 5)

     display-columns (1, 7, 15)

     alignment ("C", "R", "L")

     protection 1

     row-cursor-background-color rgb x#C8FFFF

     divider-color 8

     .

 

 ...

 

 PROCEDURE DIVISION.

 

 ...

 

 modify gd1(1, 1) cell-data "Col1"

 modify gd1(1, 2) cell-data "Col2"

 modify gd1(1, 3) cell-data "Col3"

 display entry-field numeric upon gd1(-1, 1)

 display entry-field upon gd1(-1, 2)

 display entry-field upon gd1(-1, 3)

 modify gd1 record-to-add "01AABB"

            record-to-add "02XXYY"

            record-to-add "03FFGG"

            record-to-add "04HJKL"

 

 modify gd2(1, 1) cell-data "Col1"

 modify gd2(1, 2) cell-data "Col2"

 modify gd2(1, 3) cell-data "Col3"

 modify gd2 record-to-add "01AABB"

            record-to-add "02XXYY"

            record-to-add "03FFGG"

            record-to-add "04HJKL"

 

 ...

 

 EXPORT-GRID-TO-EXCEL.

    accept excel-position from environment "excel.prefix"

    string excel-position     delimited by trailing space

           "/isCOBOLGRID.xlsx"   delimited by size

           into excel-position

 

    modify gd1 export-file-name excel-position

    modify gd1 export-file-format = "xlxs".

    modify gd1 action action-export.

 

    accept excel-position from environment "excel.js.prefix"

    string excel-position  delimited by trailing space

           "/isCOBOLGRID.xlsx" delimited by size

          into excel-position

    call "WD2$REDIRECT" using excel-position, "_blank"

                       giving return-code.