Printing a report that sits on a window procedure, and adding the preview

Applies to: a report structure created in a Window template procedure (Data embed, Ctrl-F); posted in the Clarion 6 group.

Problem

A report was created on a window template procedure. The poster asked how to trigger (print) it, and later how to add the preview.

Solution

  1. A report made this way is only a report structure. The template does not print it, so you code the printing by hand.
  2. Without preview: OPEN(Report), then PRINT(RPT:Detail), then CLOSE(Report). The poster confirmed this works.
  3. With preview, set the report output to metafiles and follow the help on PREVIEW and PrintPreviewClass:
    1. Define a PreviewQueue.
    2. Define a PrintPreviewClass object.
    3. Assign the PreviewQueue file name to the report.
    4. Set the properties of the class object, call its Display method and handle the value it returns.
  4. A shortcut from another poster: generate a report from the report template without preview and again with preview, compare the generated source and copy the preview lines across.

Caveats

  • One early reply suggested ENDPAGE(Report); the poster did not take it up.
  • The poster decided to use an ordinary template-generated report whenever he needs preview, because it is quicker.
  • The thread does not show a working preview code listing.

Today (2026)

Likely unchanged for the OPEN, PRINT, CLOSE sequence. Not re-tested; check the PrintPreviewClass help for your build.

Sources: Rupert E. (Mar 2008, the question), John G., Shankar, Paul H. (Mar 2008) in softvelocity.public.clarion6.