Entry type: FAQ Entry ID: 51723931, Entry date: 12/29/2014
(7)
Rate

How do you open a Word, Excel or PDF document with a Comfort Panel?

  • Entry
  • Associated product(s)
Comfort Panels offer the option of opening PDF, Excel and Word documents from Runtime. You can use the system function "StartProgram" to open a corresponding document.

Syntax of the "StartProgram" function

StartProgram Program name, Program parameter, Display, Wait for the end

Description of the parameters

  • Program name
    For the "Program name" parameter you specify the path and name of the program to be started.
     
  • Program parameter
    For the "Program parameter" parameter you specify the path and name of the document to be opened.
     
  • Display
    Defines how the program window is displayed on the operator panel:
    hmiShowNormal = Normal
    hmiShowMinimized = Minimized
    hmiShowMaximized = Maximized
    hmiShowMinimizedAndInactive = Minimized and inactive

    Note
    The display on 7", 9" and 12" Comfort Panels depends on the display always being set as maximized, but not full screen.
     
  • Wait for the end
    Defines whether there is to be return to the project after the called program has ended:
    hmiNo = No (there is no return to the project)
    hmiYes = Yes (there is return to the project)

Possible storage locations for the documents:

  • Memory card: "\Storage Card SD\"
  • USB stick: "\Storage Card USB\"
  • Network release: "\\Network\" (example: "\\computer_name\release_name\...")

The following file formats are supported:

  • .PDF
  • .doc (Word 97-2003)
  • .docx (Word 2007 and Word 2010)
  • .rtf (Rich Text Format)
  • .xls (Excel 97-2003)
  • .xlsx (Excel 2007 and Excel 2010)

1. When using the system function "StartProgram" on a button on a Comfort Panel, you have the following options for opening a document

For this you enter the following parameters:
 

Program name Program parameter Result
\Storage Card SD\MaschineData_01.doc (*.docx)   The specified document is opened.
\Storage Card SD\MaschineData_01.pdf   The specified document is opened.
\Storage Card SD\MaschineData_01.xls (*.xlsx)   The specified document is opened.
WinCC V13 and higher
\flash\AddOn\wt6explr.exe

Up to WinCC V12
\windows\wt6explr.exe

  The viewer starts with the "Open" dialog opened.
Here you select your PDF, Excel or Text document on your storage medium.
/d wt6pdf*.dfr The viewer starts with the "Open" dialog opened.
Here you select your PDF document on your storage medium.
/d wt6xls*.dfr The viewer starts with the "Open" dialog opened.
Here you select your Excel document (.xls, .xlsx) on your storage medium.
/d wt6xlsx*.dfr The viewer starts with the "Open" dialog opened.
Here you select your Excel document (.xlsx) on your storage medium.
/d wt6doc*.dfr The viewer starts with the "Open" dialog opened.
Here you select your Text document (.docx, .doc, .rtf) on your storage medium.
/d wt6docx*.dfr The viewer starts with the "Open" dialog opened.
Here you select your Text document (.docx) on your storage medium.
\Storage Card SD\MaschineData_01.doc (*.docx) The specified document is opened.
\Storage Card SD\MaschineData_01.pdf The specified document is opened.
\Storage Card SD\MaschineData_01.xls (*.xlsx) The specified document is opened.
Table 01

Note
MachineData_01.doc, MachineData_01.pdf and MachineData_01.xls are sample documents.

2. When using the system function "StartProgram" in a script on a Comfort Panel, you have the options below for opening a document

  • Using the function list
    Select the "StartProgram" function from the function list and enter the parameters according to the table at the lowest table.
    In the Script Editor, you place the cursor on the required point and click "Apply".
  • Manual input of the script
    Write the function directly in the Script Editor. Take the syntax from the lowest table.

You can predefine the parameters of the "StartProgram" function (as string) or provide them through tags (of the WString type).
The tags include the path specification. Make sure that the length of the tags is sufficient for the path specification. There are two types of path specification in the tags:

  • Without quotation marks (for example: \Storage Card USB\Document_name.Document_ending) - this type is referred to in the following as the "FilePath" wildcard.
  • With quotation marks (for example: "\Storage Card USB\Document_name.Document_ending") - this type is referred to in the following as the "FilePath_AZ" wildcard.

    An example for a path specification without quotation marks is the return value of the "OpenFileBrowser" function. This function saves the path of a selected file in a tag. To be able to use this path in the "StartProgram" function, the tag must be used like the "FilePath" wildcard.

If the path specification transferred to the "Program name" parameter includes spaces, the path specification has to be given in quotation marks.
This can be done before transfer to the designated tag or in the script itself. In the script, this is done by inserting the ASCII code character (34), which corresponds to a quotation mark, before and after the string.

With the "Program parameter" parameter it does not matter whether or not the path specification contains spaces.
 

Type of input

Program name (fixed)

Variable path specification via the parameter "Program parameter" Syntax in the Script Editor
Via function list WinCC V13 and higher
\flash\AddOn\wt6explr.exe
FilePath StartProgram "\flash\AddOn\wt6explr.exe", SmartTags("FilePath"), hmiShowNormal, hmiNo
FilePath_AZ StartProgram "\flash\AddOn\wt6explr.exe", SmartTags("FilePath_AZ"), hmiShowNormal, hmiNo
Up to WinCC V12
\
windows\wt6explr.exe
FilePath StartProgram "\windows\wt6explr.exe", SmartTags("FilePath"), hmiShowNormal, hmiNo
FilePath_AZ StartProgram "\windows\wt6explr.exe", SmartTags("FilePath_AZ"), hmiShowNormal, hmiNo
Manual input WinCC V13 and higher
"
\flash\AddOn\wt6explr.exe"
FilePath StartProgram "\flash\AddOn\wt6explr.exe", FilePath, hmiShowNormal, hmiNo
FilePath_AZ StartProgram "\flash\AddOn\wt6explr.exe", FilePath_AZ, hmiShowNormal, hmiNo
Up to WinCC V12
"\
windows\wt6explr.exe"
FilePath StartProgram "\windows\wt6explr.exe", FilePath, hmiShowNormal, hmiNo
FilePath_AZ StartProgram "\windows\wt6explr.exe", FilePath_AZ, hmiShowNormal, hmiNo

Table 02
 
 

Type of input Variable path specification via the parameter "Program name" Program parameter (not required) Syntax in the Script Editor
Via function list FilePath_AZ   StartProgram SmartTags("FilePath_AZ"), "",hmiShowNormal, hmiNo
Manual input FilePath_AZ "" StartProgram FilePath_AZ, "",hmiShowNormal, hmiNo
Chr(34) & FilePath & Chr(34) "" StartProgram Chr(34) & FilePath_AZ & Chr(34), "",hmiShowNormal, hmiNo

Table 03
 
 

Type of input Program name (fixed) Program parameter (fixed) Syntax in the Script Editor
Via function list WinCC V13 and higher
\flash\AddOn\wt6explr.exe
/d wt6doc*.dfr (*.pdf, *.docx, *.xls, *.xlsx) StartProgram "\flash\AddOn\wt6explr.exe", "/d wt6doc*.dfr", hmiShowNormal, hmiNo
Up to WinCC V12
\
windows\wt6explr.exe
StartProgram "\windows\wt6explr.exe", "/d wt6doc*.dfr", hmiShowNormal, hmiNo
Manual input WinCC V13 and higher
"
\flash\AddOn\wt6explr.exe"
"/d wt6doc*.dfr" (*.pdf, *.docx, *.xls, *.xlsx) StartProgram "\flash\AddOn\wt6explr.exe", "/d wt6doc*.dfr", hmiShowNormal, hmiNo
Up to WinCC V12
"\
windows\wt6explr.exe"
StartProgram "\windows\wt6explr.exe", "/d wt6doc*.dfr", hmiShowNormal, hmiNo
Table 04

Before calling the "StartProgram" function it is recommended to check whether there is a path specification:

If FilePath <> "" Then
StartProgram Program name, Program parameter, Display, Wait for the end
End If

Note
When upgrading to WinCC V13, you must change the path of the File Viewer accordingly. The compiler does not recognize incorrect paths.

Additional Keywords
Office, Viewer, File viewer, Adobe Reader, Acrobat Reader, Document viewer, File, Storage, Storage path

 

Security information
In order to protect technical infrastructures, systems, machines and networks against cyber threats, it is necessary to implement – and continuously maintain – a holistic, state-of-the-art IT security concept. Siemens’ products and solutions constitute one element of such a concept. For more information about cyber security, please visit
https://www.siemens.com/cybersecurity#Ouraspiration.
Rate entry
no rating
Requests and feedback
What do you want to do?
Note: The feedback always relates to the current entry / product. Your message will be forwarded to our technical editors working in the Online Support. In a few days, you will receive a response if your feedback requires one. If we have no further questions, you will not hear from us.