Skip to main content

[archive] xls file...

  • June 16, 2008
  • 4 replies
  • 0 views

[Migrated content. Thread originally posted on 16 June 2008]

Hello,

Is it possible to create excel file( xls ) from a vision data file directly from a cobol program?
If yes, can you share a program please?

Regards

4 replies

[Migrated content. Thread originally posted on 16 June 2008]

Hello,

Is it possible to create excel file( xls ) from a vision data file directly from a cobol program?
If yes, can you share a program please?

Regards
Here's a bit to get you going.
You'll need an excel .def file which can be created using axdefgen.

A heading


           CREATE  @Application OF @Excel HANDLE IN olExcel
           MODIFY  olExcel @Visible = 0
           MODIFY  olExcel Workbooks::Add() GIVING olWrkBk
           INQUIRE olWrkBk Worksheets::Item(1) IN olWrkSh
           MODIFY  olWrkSh Range("A1")::Value = "Code"
                           Range("B1")::Value = "Description"
                           Range("C1")::Value = "This Month"
                           Range("D1")::Value = "Quantity"
                           Range("E1")::Value = "Margin"
                           Range("F1")::Value = "This YTD"
                           Range("G1")::Value = "Quantity"
                           Range("H1")::Value = "Margin"
                           Range("I1")::Value = "This Month"
                           Range("J1")::Value = "Quantity"
                           Range("K1")::Value = "Margin"
                           Range("L1")::Value = "This YTD"
                           Range("M1")::Value = "Quantity"
                           Range("N1")::Value = "Margin"


Some data

           MOVE "A"  TO WS-EXL-CELL(1:1)
           MOVE WS-Y TO WS-EXL-CELL(2:4)
           MODIFY  olWrkSh Range(WS-EXL-CELL)::Value = S-ISM-CODE
           MOVE "B"  TO WS-EXL-CELL(1:1)
           MOVE WS-Y TO WS-EXL-CELL(2:4)
           MODIFY  olWrkSh Range(WS-EXL-CELL)::Value = S-ISM-DESC
           MOVE "C"  TO WS-EXL-CELL(1:1)
           MOVE WS-Y TO WS-EXL-CELL(2:4)
           MODIFY  olWrkSh Range(WS-EXL-CELL)::Value = S-ISM-NETT-TM
           MOVE "D"  TO WS-EXL-CELL(1:1)
           MOVE WS-Y TO WS-EXL-CELL(2:4)
           MODIFY  olWrkSh Range(WS-EXL-CELL)::Value = S-ISM-QTY-TM
           MOVE "E"  TO WS-EXL-CELL(1:1)
           MOVE WS-Y TO WS-EXL-CELL(2:4)
           MODIFY  olWrkSh Range(WS-EXL-CELL)::Value = S-ISM-MARGIN-TM
           MOVE "F"  TO WS-EXL-CELL(1:1)
           MOVE WS-Y TO WS-EXL-CELL(2:4)
           MODIFY  olWrkSh Range(WS-EXL-CELL)::Value = S-ISM-NETT-YTD
           MOVE "G"  TO WS-EXL-CELL(1:1)
           MOVE WS-Y TO WS-EXL-CELL(2:4)
           MODIFY  olWrkSh Range(WS-EXL-CELL)::Value = S-ISM-QTY-YTD
           MOVE "H"  TO WS-EXL-CELL(1:1)
           MOVE WS-Y TO WS-EXL-CELL(2:4)
           MODIFY  olWrkSh Range(WS-EXL-CELL)::Value = S-ISM-MARGIN-YTD
           MOVE "I"  TO WS-EXL-CELL(1:1)
           MOVE WS-Y TO WS-EXL-CELL(2:4)
           MODIFY  olWrkSh Range(WS-EXL-CELL)::Value = S-ISM-NETT-LM
           MOVE "J"  TO WS-EXL-CELL(1:1)
           MOVE WS-Y TO WS-EXL-CELL(2:4)
           MODIFY  olWrkSh Range(WS-EXL-CELL)::Value = S-ISM-QTY-LM
           MOVE "K"  TO WS-EXL-CELL(1:1)
           MOVE WS-Y TO WS-EXL-CELL(2:4)
           MODIFY  olWrkSh Range(WS-EXL-CELL)::Value = S-ISM-MARGIN-LM
           MOVE "L"  TO WS-EXL-CELL(1:1)
           MOVE WS-Y TO WS-EXL-CELL(2:4)
           MODIFY  olWrkSh Range(WS-EXL-CELL)::Value = S-ISM-NETT-LYTD
           MOVE "M"  TO WS-EXL-CELL(1:1)
           MOVE WS-Y TO WS-EXL-CELL(2:4)
           MODIFY  olWrkSh Range(WS-EXL-CELL)::Value = S-ISM-QTY-LYTD
           MOVE "N"  TO WS-EXL-CELL(1:1)
           MOVE WS-Y TO WS-EXL-CELL(2:4)
           MODIFY  olWrkSh Range(WS-EXL-CELL)::Value = S-ISM-MARGIN-LYTD




Some very basic formatting


           INQUIRE olWrkSh @Range("A1:N1") in olRange
           MODIFY  olRange @Font::Bold = 1
           DESTROY olRange
           MODIFY  olExcel Range("A1:N65536")::Select()
           INQUIRE olExcel Range("A1:N65536")in olRange
           MODIFY  olRange Columns::AutoFit()
           DESTROY olRange
           MODIFY  olExcel Range("A1")::Select()
           DESTROY olRange                           
           MODIFY  olExcel @Visible = 1                   
           DESTROY olWrkBk
           DESTROY olExcel

[Migrated content. Thread originally posted on 16 June 2008]

Hello,

Is it possible to create excel file( xls ) from a vision data file directly from a cobol program?
If yes, can you share a program please?

Regards
Thanks, and if I may ask...

.def file, do you mean to create a kind of active-x control?
If yes, I have seen some application which allow the user to choose some fields from their database and with one click, all selected fileds are created in a nice xls file.

Would you mind helping a bit more?

Regards...

[Migrated content. Thread originally posted on 16 June 2008]

Hello,

Is it possible to create excel file( xls ) from a vision data file directly from a cobol program?
If yes, can you share a program please?

Regards
If you use the utility axdefgen and find the microsoft office excel control you can then create the .def file required.

I could post my excel definations file, but its probably best if you generate your own with your own version of excel

[Migrated content. Thread originally posted on 16 June 2008]

Hello,

Is it possible to create excel file( xls ) from a vision data file directly from a cobol program?
If yes, can you share a program please?

Regards
Thanks for your help...