Highlighted
Absent Member.
Absent Member.
302 views

[archive] Printing a wordpad document

[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
0 Likes
2 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] Printing a wordpad document

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).
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] Printing a wordpad document

Thanks man! 😄
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.