Publisher and Web Interface > Publisher > Creating and customizing Publisher styles > Including your own custom style and formatting parameter values in generated Word documents (Publisher)
  
Including your own custom style and formatting parameter values in generated Word documents (Publisher)
This topic provides instructions for creating your own custom style parameters and formatting parameters for a Publisher Style, and instructions for making the values set in Publisher for these properties appear in generated documents.
To create your own custom style and formatting parameters for a Publisher style and then make the set values appear in generated Word documents, you must perform the following tasks:
Create your own custom style parameters.
You do this through the Publisher Style's commonparams.xsl file.
Create your own formatting parameters.
You do this through the Publisher Style's docbookparams.xsl file.
Define the types of your parameters.
You do this through the Publisher Style's ParameterSettings.xsl file.
Map your parameters to Word document properties.
You do this through the docbook2word.xls file.
Create the Word document properties in the required Word document template and then create fields to reference those properties.
You do this through the titlepage.xml file for the title page, or through the wordml.template.xml file for main Word document.
Important: We recommend that you do not include your own custom style and formatting parameters in the provided Publisher Styles, but instead create a new Publisher Style and make the changes to that.
To create your own custom style parameters:
1. Locate the commonparams.xsl file for the Publisher Style:
The commonparams.xsl file resides in the following folder.
C:\ProgramData\PTC Integrity Modeler\Publisher\Stylesheets\DocumentGeneration\CustomDocBook\<Publisher Style folder>
2. Using a text editor such as Notepad, open the commonparams.xslfile.
3. For each custom style parameter you want to create, create an entry such as follows (you can copy and paste an existing entry and change it as necessary):
<xsl:param name="my.custom.style.parameter" select="'Default value of my.custom.style.parameter'"/>
The preceding example creates a custom style parameter named 'my.custom.style.parameter' that has a default value of 'Default value of my.custom.style.parameter'.
4. Save the changes you have made.
You can now create any formatting parameters you require.
To create your own formatting parameters:
1. Locate the docbookparams.xsl file for the Publisher Style:
a. The Publisher Style folders reside in subfolders of the following folder.
C:\ProgramData\PTC Integrity Modeler\Publisher\Stylesheets\DocumentGeneration\CustomDocBook
b. In the folder for the Publisher Style, locate the docbookparams.xsl file that resides in the following folder:
<Publisher Style folder>\Word\Current
2. Using a text editor such as Notepad, open the docbookparams.xslfile.
3. For each formatting parameter you want to create, create an entry such as follows (you can copy and paste an existing entry and change it as necessary):
<xsl:param name="my.formatting.parameter" select="'Default value of my.formating.parameter'"/>
The preceding example creates a formatting parameter named 'my.formatting.parameter' that has a default value of 'Default value of my.formating.parameter'.
4. Save the changes you have made.
You must now define the types for any parameters you have created.
To define the types of your parameters:
1. Locate the ParameterSettings.xml file for the Publisher Style
:
The ParameterSettings.xml file resides in subfolders of the following folder.
C:\ProgramData\PTC Integrity Modeler\Publisher\Stylesheets\DocumentGeneration\CustomDocBook\<Publisher Style folder>
2. Using a text editor such as Notepad, open the ParameterSettings.xmlfile.
3. For each custom style parameter and each formatting parameter you have created, create entries such as follows (you can copy and paste an existing entry and change it as necessary):
<param name="my.custom.style.parameter" type="string" />
<param name="my.formatting.parameter" type="string" />
The preceding example defines the types (string in both cases) for the 'my.custom.style.parameter' custom style parameter and the 'my.formatting.parameter' formatting parameter.
4. Save the changes you have made.
You must now map your parameters to Word document properties.
To map your parameters to Word document properties:
1. Locate the docbook2word.xsl file for the Publisher Style:
a. The Publisher Style folders reside in subfolders of the following folder.
C:\ProgramData\PTC Integrity Modeler\Publisher\Stylesheets\DocumentGeneration\CustomDocBook
b. In the folder for the Publisher Style, locate the docbook2word.xsl file that resides in the following folder:
<Publisher Style folder>\Word\Current
2. Using a text editor such as Notepad, open the docbook2word.xslfile.
3. For each custom style parameter and each formatting parameter you have created, create entries such as follows (you can copy and paste an existing entry and change it as necessary):
<o:my_x0020_custom_x0020_style_x0020_parameter dt:dt="string">
<xsl:value-of select="$my.custom.style.parameter"/>
</o:my_x0020_custom_x0020_style_x0020_parameter>
<o:my_x0020_formatting_x0020_parameter dt:dt="string">
<xsl:value-of select="$my.formatting.parameter"/>
</o:my_x0020_formatting_x0020_parameter>
The preceding example maps the 'my.custom.style.parameter' custom style parameter to a Word document property named 'my custom style parameter', and maps the 'my.formatting.parameter' formatting parameter to a Word document property named 'my formatting parameter'. The '_x0020_' text defines a space.
4. Save the changes you have made.
To create the Word document properties in the required Word document template and then create fields to reference those properties:
1. Locate the Word template you want to change:
a. The Publisher Style folders reside in subfolders of the following folder.
C:\ProgramData\PTC Integrity Modeler\Publisher\Stylesheets\DocumentGeneration\CustomDocBook
b. In the folder for the appropriate Publisher Style, locate the titlepage.xml and wordml.template.xmlfiles that reside in the following folder:
\<Publisher Style folder>\Word\Current
2. In Word, open the titlepage.xml file to change the title page, or open the wordml.template.xml file to change headers or footers in the main document.
3. In Word, open the Document Properties dialog:
For Word: File > Info > Properties > Advanced Properties.
Note that after clicking Info, the Properties link appears at the top of the right pane.
If after clicking Properties a bar appears stating 'The Document Information Panel was unable to load', click the drop-down arrow in the bar and then click the Advanced Properties command.
4. Click the Custom tab and create a new document property for each parameter you have mapped. The name of each document property must be as defined in the docbook2word.xsl file, and you must select a Type and set a Value.
In our example, we create document properties named 'my custom style parameter' and 'my formatting parameter', as defined in the docbook2word.xsl file. We set the Type to Text and specify a default Value. Note that the Add button is enabled only after entering text in the Value box; the value you enter is not used.
5. In the title page of the titlepage.xml template, or in the headers or footers of the wordml.template.xml, create a field for each the document property you have created:
a. In the template, move the cursor to where you want to add the referencing field.
b. On the Insert ribbon, in the Text group, click Quick Parts, and then click Field.
c. In the Field Names list, selectDocProperty.
d. In the Property list, select the document property you want to add to your document.
e. Click OK.
6. Save the changes you have made to the Word template.
Important: If you are using Word, perform a Save operation. If you perform a Save As operation, ensure that you choose Word 2003 XML as the format.