Such created HTML page can be in the graph or table form and it can be used, for example, for printing (see Example1).
value = oTView.SaveToHtm(sSrcHtm, sDstHtm, sParams)
|sSrcHtm||(String) Entering an empty string "" means that the model is generated by the PROMOTIC system.|
|sDstHtm||(String) Location for saving the HTML page. It is either: |
- disk file that is newly created - The file name with the path specified with the prefix file: (e.g. the "file:c:/dest.htm"). If a full path is not entered, then it is completed relative to the application file folder (if the trends viewer runs in the PROMOTIC application).
- string in variable (String) - In this case the parameter is of the input/output type (the input is "string:") and after calling the method it contains the contents of the HTML page.
|sParams||(String) Additional parameters that define the way of creating the destination file. Entries are in KeyVal format, for example "mode:graph;view:dlg;".|
"mode:xxx;" (optional) - Specifies which page is used for displaying the data of the trends viewer
table (default) - page in the table form
graph - page in the graph form of 2-dimensional graph
"graphcfg:xxx;" (optional) - Specifies what setting is used for graphic trend viewer (PmgTrendViewer) in saved HTML page. The HTML page contains its own object (PmgTrendViewer).
default (default) - All settings of the viewer in the saved HTML page will be default (except for time from-to).
copy - All settings of the viewer in the saved HTML page will be taken from the viewer, that was called by the SaveToHtm method.
"view:xxx;" (optional) - Specifies whether and how the generated page has to be displayed
no (default) - is not displayed
dlg - generated page is displayed in the window with preset size
"text_xxx:yyy;" (optional) - Template (referred by the sSrcHtm parameter) contains several predefined keywords that allows to enter the designer text, which appears in the final page (referred by the sDstHtm parameter) instead of the keyword, see the description of values.
text_title - Value of the keyword title from the template (sSrcHtm) will be replaced by the string yyy.
Example: text_title:BoilerPlant 5;
text_note1 - Value of the keyword note1 from the template (sSrcHst) will be replaced by the string yyy.
text_note2 - Value of the keyword note2 from the template (sSrcHst) will be replaced by the string yyy.
If a char ; (semicolon) occurs in the yyy string, then it is necessary to set text_codeinit:$Par:0; and the initialization code itself has to be set in the sParText parameter, see Example4. The oTView reference used in the example is the reference to the PmgTrendViewer trends viewer and his name must be kept.
text_userYY - Except the predefined keywords it is possible to edit the copy of the template (copied from the original template from the PROMOTIC Web folder, see the description of the sSrcHst parameter) and to add next keywords in it and to define the string for replacement in this parameter. For example, if there is the userkey keyword in the HTML template, then the parameter is:
text_userkey:text for displaying;
|sParText||[optional] (String) Text for replacing the key word codeinit from the template. See the description of the sParams parameter, the codeinit value.|
var oTView = pMe;
var sHtml = oTView.SaveToHtm("", "return;", "mode:graph;");
if (sHtml != "")
oTView.SaveToHtm "", "file:trendprint.htm", "mode:graph;"
Pm.ShellExecute "open", "#app:trendprint.htm", "", "#app:", 1
oTView.SaveToHtm "", "file:trendprint.htm", "mode:graph;view:dlg;"
oTView.SaveToHtm "", "file:trendprint.htm", "mode:graph;view:dlg;text_title:Factory station;text_note1:Ironware district;text_note2:Page created by John Weiss;"
sParCode = "oTView.TrendArea.Dx = 540;"
oTView.SaveToHtm "", "file:trendprint.htm", "mode:graph;view:dlg;text_codeinit:$Par:0;", sParCode