Skip to main content

[archive] Printing a wordpad document

  • August 12, 2009
  • 2 replies
  • 0 views

[Migrated content. Thread originally posted on 12 August 2009]

Hello all,

Well, is this, how i can print a wordpad document from cobol? some ideas?

Thanks

2 replies

[Migrated content. Thread originally posted on 12 August 2009]

Hello all,

Well, is this, how i can print a wordpad document from cobol? some ideas?

Thanks
Wordpad are RTF-Files.

you can use write.exe (Wordpad to Print) but then the default printer is used.

For example:
call "C$SYSTEM" using "write.exe c:\\test.rtf /p"



The other way is to use activeX

For example the "MS Rich Textbox Control".


       IDENTIFICATION               DIVISION.
       PROGRAM-ID.                  GRIDCTL.
       ENVIRONMENT                  DIVISION.
       CONFIGURATION                SECTION.
       SPECIAL-NAMES.
           COPY    "RICH.DEF".
           .
       INPUT-OUTPUT SECTION.
       FILE-CONTROL.
           SELECT PRINT-FILE
           ASSIGN TO PRINT "-P SPOOLER".
       DATA DIVISION.
       FILE SECTION.
       FD  PRINT-FILE.
       01  PRINT-REC.
           03 FILLER       PIC X(80).

       WORKING-STORAGE SECTION.
       77 H-ACU-SPOOLER-DC PIC 9(9) COMP-5 EXTERNAL.
       77  KEY-STATUS               IS SPECIAL-NAMES
           CRT STATUS               PIC 9(4) VALUE 0.
           88  EXIT-PRESSED         VALUE 13.
       SCREEN      SECTION.
       01  RICH-SCREEN.
           03      EDIT-BOX         RICHTEXTBOX
                   LINE             02
                   COL              02
                   SIZE             78
                   LINES            10.
           03      PUSH-BUTTON
                   LINE             13
                   COL              61
                   SIZE             14
                   TITLE            "E&xit"
                   SELF-ACT
                   EXCEPTION-VALUE  = 13.
       PROCEDURE DIVISION.
       MAIN-LOGIC.
           DISPLAY STANDARD         GRAPHICAL WINDOW
                   TITLE            "RichTextBox & OLE Demo"
                   SIZE             80
                   LINES            15
                   BACKGROUND-LOW.
           DISPLAY RICH-SCREEN.
           MODIFY  EDIT-BOX         TEXT =
                   "Type your text here, or drag and drop..."
                   OLEDRAGMODE      = rtfOLEDragAutomatic
                   OLEDROPMODE      = rtfOLEDropAutomatic.
           ACCEPT  RICH-SCREEN.
           OPEN    OUTPUT     PRINT-FILE.
           WRITE   PRINT-REC        FROM "Combining COBOL and ActiveX".
           [COLOR="Red"][b]MODIFY  EDIT-BOX         SelPrint(H-ACU-SPOOLER-DC, 0).[/b][/COLOR]
           CLOSE   PRINT-FILE.
           STOP    RUN.


i got this example from gforseth some time ago.

Edit:
i forget a line :)
to load the rtf file in the edit-box
modify EDIT-BOX LoadFile ("c:\\muffrohr\\test.rtf", rtfRtf).

[Migrated content. Thread originally posted on 12 August 2009]

Hello all,

Well, is this, how i can print a wordpad document from cobol? some ideas?

Thanks
Thanks man! :D