ARROWNEW.gif (13464 bytes)Instruction

This document shows you how to configure HTM reports with trend images and how to automatically print out a HTM report at Citect runtime.

The example shown here requires:

  1. MS Web Browser ActiveX - shdocvw.dll (a component of IE 5.0). Make sure the file exists on your PC. It is normally located in the directory \WINNT\SYSTEM32 for NT and Windows2000, \WINDOWS\SYSTEM for Windows98.
  2. Citect V521 or higher.
  3. Cando.gif (included in this demo).
  4. Trend2.bmp (included in this demo).
  5. Arrownew.gif (included in this demo).

 

How to include a trend image in a HTM report

  1. Organize a folder to store your trend images in.
  2. Write a user function. Use WinNewAt or TrendWin to create a temporary page (offside the display area, the user won't notice) and then display the trends of interest. Next use WinFile to dump a trend image into a temporary file. Use FileCopy to copy the temporary file to the file that will be included in the HTM file. Finally, use WinFree to free the page. It is noted that function WinFile may not work correctly above 256 (8-Bit) colors. If you have a difficulty with image capture, change the desktop to 256 colors.
  3. Modify the HTM report template, Report.Htm. Find the line <IMG id="Picture1" HEIGHT=330 WIDTH=500 SRC=".\Trend2.bmp" BORDER=0 ALT="Top" >.Replace the image location and name ".\Trend2.bmp" with the one to be included. It is noted that the HTM file supports the relative directory.
  4. To automatically dump the trend image to a file, enable event DumpTrend and click on the button "Auto" on page File_HTM (which sets tag AutoDumpTrendFlag = 1).
  5. To focus on a specified pen, enter the new value (1-8) to the focus pen field on page File_HTM.

 

How to automatically print a HTM report

  1. Write a Citect event to update the trend image before printing the report.
  2. Use WinNewAt to create a temporary page to display "File_Htm" where Web Browser ActiveX is embedded.
  3. Use HtmFileOpen (STRING An, STRING FileName) to open the generated report (it actually calls the ActiveX method Navigate). The first argument is the animation point where the ActiveX is created, and the second one is the generated report name including its location.
  4. Use HtmFilePrint (STRING An, INT PrintPrompt) to print the generated report where the second argument is the print option. In this case, use PrintPrompt = 2 to send the report to the default printer.
  5. Use WinFree to free the page.
  6. Use a Citect event to control steps 2-5.

 

Methods of Web Browser ActiveX used in this example

  1. Navigate(URL, [Flags], [TargetFrameName], [PostData], [Headers]) – The arguments in [ ] are optional. Normally, the optional arguments can be ignored. However, when this method is called in Citect, all optional arguments have to be included. URL could be a file or a Web site address, such as www.cit.com.au and \\NodeName\SharedDirectory\FileName. Please refer to the function HtmFileOpen in the Cicode file ActiveX.
  2. GoHome – this method has no argument. It uses the home address configured in your IE or Netscape and displays the home page.
  3. GoBack – this method has no argument. It displays the previous page. If there is no previous page available, calling it will trigger an error. The error will be intercepted by Citect and displayed on the Hardware alarm page.
  4. Refresh – this method has no argument. It refreshes the current page.
  5. ExecWB(CmdID, CmdOption, [pvaIn], [pvaOut]) – the first argument is the command ID, for instance 6 stands for the print command. The second one is the command option, for instance the print command has four options, 0 for default, 1 for user prompt (allows a user to select a different printer), 2 for default printer (no user prompt) and 3 for help. Please refer to the function HtmFilePrint in the Cicode file ActiveX.