User Tools

Site Tools


preview_set_report_output_to_metafiles_.htm
Navigation:  Language Reference > 9 -  Window and Report Attributes > Window and Report Attributes >====== PREVIEW (set report output to metafiles) ====== Previous pageReturn to chapter overviewNext page

PREVIEW(queue)

blk2blue.jpg

PREVIEW Specifies report output goes to Windows metafiles containing one report page per file.
queue The label of a QUEUE or a field in a QUEUE to receive the names of the metafiles.

The PREVIEW attribute (PROP:PREVIEW. write-only) on a REPORT sends the report output to Windows metafiles containing one report page per file. The PREVIEW attribute names a queue to receive the names of the metafiles. The filenames are temporary filenames internally created by the Clarion library and are complete file specifications (up to 64 characters, including drive and path), unless you use PROP:TempNameFunc to provide your own names for these files. The temporary files listed in the preview queue are deleted from disk when you CLOSE the REPORT. To prevent the files from being deleted from the disk, delete them from the queue.

You can create a window to display the report in an IMAGE control, using the queue containing the file names to set the IMAGE control's {PROP:Text} property. This allows the end user to view the report before printing. A runtime-only property, {PROP:FlushPreview}, when set to ON, flushes the metafiles to the printer.

Example:

SomeReport PROCEDURE

WMFQue    QUEUE                          !Queue to contain .WMF filenames

PageImage  STRING(64)

         END

NextEntry  BYTE(1)                       !Queue entry counter variable

Report  REPORT,PREVIEW(WMFQue.PageImage) !Report with PREVIEW attribute

DetailOne  DETAIL

          !Report controls

          END

       END

ViewReport WINDOW('View Report'),AT(0,0,320,200),MDI,MAX,HVSCROLL

           IMAGE(''),AT(0,0,320,180),USE(?ImageField)

           BUTTON('View Next Page'),AT(0,180,60,20),USE(?NextPage),DEFAULT

           BUTTON('Print Report'),AT(80,180,60,20),USE(?PrintReport)

           BUTTON('Exit Without Printing'),AT(160,180,60,20),USE(?ExitReport)

          END

CODE

OPEN(Report)

SET(SomeFile)                              !Code to generate the report

LOOP

 NEXT(SomeFile)

  IF ERRORCODE() THEN BREAK.

 PRINT(DetailOne)

END

ENDPAGE(Report)

OPEN(ViewReport)                           !Open report preview window

GET(WMFQue,NextEntry)                      !Get first queue entry

?ImageField{PROP:text} = WMFQue.PageImage  !Load first report page

ACCEPT

 CASE ACCEPTED()

 OF ?NextPage

  NextEntry += 1                           !Increment entry counter

  IF NextEntry > RECORDS(WMFQue)           !Check for end of report

   CYCLE

  END

  GET(WMFQue,NextEntry)                    !Get next queue entry

  ?ImageField{PROP:text} = WMFQue.PageImage!Load next report page

  DISPLAY                                  !and display it

 OF ?PrintReport

  Report{PROP:flushpreview} = TRUE         !Flush files to printer

  BREAK                                    !and exit procedure

 OF ?ExitReport

  BREAK                                    !Exit procedure

 END

END

CLOSE(ViewReport)                          !Close window

FREE(WMFQue)                               !Free the queue memory

CLOSE(Report)                              !Close report (deletes all .WMF files)

RETURN                                     !and return to caller

See Also: ENDPAGE, PAGENO, PROP:NextPageNo

preview_set_report_output_to_metafiles_.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1