Customize the Ribbon
Windchill Desktop Integration allows system administrators to introduce custom buttons on the Windchill tab in Microsoft Office applications. The only requirement is the presence of a valid XML file with the custom ribbon user interface definition. This file must be located in the following location:
<Windchill>/codebase/com/ptc/windchill/enterprise/nativeapp
/msoi/client/custom/wtCustomMenu.xml
For more information on the ribbon UI, see the Microsoft documentation on ribbons.
All custom actions required to be implemented must be located inside an action group. This serves as the root/document element for the custom ribbon UI in XML.
Adding a button node as child to the group makes it display on the ribbon UI as a clickable item.
The following example illustrates a custom action group with two buttons:
<group id="MyCustomActions" tag="MyCustomActions"
getLabel="MsoiGetLabel" getScreentip="MsoiScreentip"
getVisible="MsoiServerVisible">

<button id="CustomAction01" tag="CustomAction01" enabled="true"
label="Custom Action 01"
screentip="Click this to launch the first custom action"
getImage="MsoiGetImage" onAction="MsoiOnAction" keytip="ca1"/>

<button id="CustomAction02" tag="CustomAction02" getEnabled="MsoiIsEnabled"
getLabel="MsoiGetLabel" getScreentip="MsoiScreentip" getImage="MsoiGetImage"
onAction="MsoiOnAction" keytip="ca2"/>
</group>
To control the visibility of the group:
getVisible—To make the group visible only when connected to an active Windchill server, set this attribute to MsoiServerVisible.
visible—If the group should be visible at all times, remove the getVisible attribute and set visible to true.
To control the button state:
getEnabled—If you set this attribute to MsoiIsEnabled, then the button remains disabled unless server-side changes explicitly render the button enabled or disabled.
enabled—If the button should be enabled whenever the group is visible, remove the getEnabled attribute from the button node and set enabled to true.
* 
The attributes label and screentip control the label and the tooltip for the button respectively. In general, static text marginally improves performance.
To localize a custom menus, you must use getLabel and getScreentip instead.
Creating an Application-Specific Custom Menu
Windchill Desktop Integration supports customization of the ribbon UI for a specific Microsoft Office application. Append the short application name to the file name. For example, the following file would create a new button that only displays in Microsoft Excel:
<Windchill>/codebase/com/ptc/windchill/enterprise/nativeapp/msoi/client/custom/wtCustomMenuExcel.xml
Add the following code:
<?xml version="1.0"?>
<groups>
<group id="ExcelActionsGroup" tag="ExcelActionsGroup"
label="Excel actions group" screentip="Custom Excel
actions group" visible="true">

<button id="MyExcelButton" tag="MyExcelButton" enabled="true"
label="Invoke my own custom Excel action"
screentip="Clicking here will launch my own Excel action."
getImage="MsoiGetImage" onAction="MsoiOnAction" keytip="ea"/>
</group>
</groups>
Localizing Text
Windchill Desktop Integration allows a way to localize the text displayed on the ribbon UI. This enables end users to see translations in their native languages.
* 
Localization of ribbon button labels and screentips work only when the label and screentip attributes are replaced with getLabel and getScreentip attributes. The values for these attributes must be set to MsoiGetLabel and MsoiScreentip respectively.
PTC recommends that the id and the tag attributes be left as unique text. Windchill Desktop Integration use the tag attribute for further processing, as mentioned below.
To localize the ribbon UI, perform the following actions:
1. Localize the label.
Add a new node to the following file (or its locale-specific equivalents) on the server:
<Windchill>/codebase/com/ptc/windchill/enterprise/nativeapp/msoi/client/custom/wtCustomLabels.xml
For example, adding the relevant node text to wtCustomLabels_ru.xml translates the menu into Russian.
The format of the node is as follows:
<CustomAction02>
<short>Custom Action 02</short>
</CustomAction02>
The parent node name (“CustomAction02”) must match the tag attribute of the group and button.
2. Localize the tooltip.
This is similar to the label except that the child node should be named tooltip. The format of the node is as follows:
<CustomAction02>
<short>Custom Action 02</short>
<tooltip>Click here to launch this custom action</tooltip>
</CustomAction02>
3. Deploy the translations to all clients.
After the changes are saved on the server, a copy of this file is automatically picked up by the Windchill Desktop Integration client.
Isto foi útil?