DesignMaster (W)

Modified on Mon, 5 Oct at 1:55 PM

Our DesignMaster is a tool for copying different Word elements, such as styles, margins, theme, headers and footers from a master document to other documents. You can also adjust the proofing language in the document.

Module is located here:

Code
...\ModuleLibrary\BaseExtensions\01_nocontext_Tools\67_W_copyDesignWithDesignMaster.xml 

This feature can copy the elements to both a single destination document or all documents in a specified folder. Therefore, two functions are included:

CMD: <Cmd case="BaseExtensions:ApplyDesignMaster"/>

Description: Copies different Word elements from the master document to a single destination document.

CMD: <Cmd case="BaseExtensions:ApplyDesignMasterToAll"/>

Description: Copies different Word elements from the master document to all documents in a specified folder.

Parameters:

Which elements that should be copied is specified in the parameters below.

Master or DesignMaster or design-master

Specify the full path to the master document or template from where the elements should be copied. It is also possible to use the keyword Ask, which opens a folder where the master document can be selected. If this parameter is not used, the default value will be Ask.

Defined path can contain environmental variable %ContentFolder%. This will direct the command to look in this location: ...\OfficeExtensions\Content\BaseExtensions. This can be handy if client environment varies from user to user, for instance if they are running Citrix. Be aware that parameter must point to the specific file, i.e. %ContentFolder%\MasterFile.docx

Folder or folder

If the parameter above is set to Ask, specify the path to the folder that should be opened. If this parameter is not used, the default value will be %UserTemplates%.

Destination or destination

Specify the full path to the destination document or the folder in which the documents are present. It is also possible to use the keyword ActiveDocument or Ask. If this parameter is not used, the default value will be ActiveDocument, which copies from master into the active document.

IncludeStyles or include-styles

Define to be true if the feature should copy all styles from the master document into the destination document(s). Styles that are not defined in the master document will not be deleted from the destination document. Default value is true, and any other value than false will evaluate to true.

IncludeMargins or include-margins

Define to be true if the feature should copy margins and distance to headers and footers from the master document to the destination document(s). Default value is true, and any other value than false will evaluate to true. Default value is true, and any other value than false will evaluate to true.

IncludeDifferentFirstPage or include-different-first-page

Define to be true if the feature should copy the settings for a different first page from the master document to the destination document(s). Default value is false, and any other value than true will evaluate to false.

IncludeDocumentProperties or include-document-properties

If this parameter is set to true, the feature will delete all custom document properties in the destination document and then copy all custom document properties from the master document to the destination document. Default value is false, and any other value than true will evaluate to false.

IncludeDocumentTheme or include-document-theme

Define to be true if the feature should copy the document theme from the master document to the destination document(s). Default value is true, and any other value than false will evaluate to true.

IncludeHeaders or include-headers

Define to be true if the feature should copy all document headers from the master document when corresponding headers exists in the destination document(s). If the destination document has more headers defined than the master document, these headers will not be updated. Default value is false, and any other value than true will evaluate to false.

IncludeFooters or include-footers

Define to be true if the feature should copy all document footers from the master document when corresponding footers exists in the destination document(s). If the destination document has more footers defined than the master document, these footers will not be updated. Default value is false, and any other value than true will evaluate to false.

ProofingLanguage or proofing-language

The new proofing language which should be used and it must be selected from this WdLanguageID

StylesSetProofingLanguage or styles-set-proofing-language

Defines which styles in the document should update their proofing language. It is a list of strings separated by ; and it can include builtin stylenames from WdBuiltinStyle or custom names as string.
A third option is "All" which will update all styles that has a languageID-property.
If omitted only the Normal-style (wdStyleNormal) will be updated.
Example: StylesSetProofingLanguage="Normal;wdStyleHeading1;wdStyleHeading2"
Note: Stylenames are subject to user-language so "Heading 1" is not always "Heading 1" for the user.

SearchMask parameters

The following parameters specify how the filedialog that opens on master="Ask" is configured, and how the command ApplyDesignMasterToAll should behave.

FilesIncludeMask or files-include-mask

Specify the type of files that should be displayed when the folder is opening when the first parameter is set to Ask. Default value is *.doc*;*.dot*.

FilesExcludeMask or files-exclude-mask

This parameter works when using the ApplyDesignMasterToAll command. Specify the MS-DOS wildcard pattern for files to exclude from folder searches defined by FilesIncludeMask. Default value is *\~$*;~$*;*\Normal*.*;Normal*.*;*\NormalEmail.*;NormalEmail.*;Thumbs.db.

FolderExcludeMask or folder-exclude-mask

This parameter works when using the ApplyDesignMasterToAll command. Specify the MS-DOS wildcard pattern for folders to exclude from folder searches defined by FilesIncludeMask. Default value is *.zip;*.cab;*Themes*;*LiveContent*.

ExcludeEmptyFolders or exclude-empty-folders

This parameter works when using the ApplyDesignMasterToAll command. Specify whether the internal function GetFileList() should exclude empty subfolders or subfolders that may include other files than those found by the filtering (ie. consider such folders empty). Default value is true, and any other value than false will evaluate to true.


A complete example of use

XML
<Button label="Apply DesignMaster">
  <Cmd case="BaseExtensions:ApplyDesignMaster"
  master="Ask"
  Destination="ActiveDocument"
  Folder="%UserTemplates%"
  IncludeStyles="true"
  IncludeMargins="true"
  IncludeDifferentFirstPage="true"
  IncludeDocumentProperties="true"
  IncludeDocumentTheme="false"
  IncludeHeaders="true"
  IncludeFooters="true"
  ProofingLanguage="wdNorwegianBokmol" 
  StylesSetProofingLanguage="Normal;wdStyleHeading1;wdStyleHeading2" />
</Button>

When the user clicks the button, a folder will prompt and enable the user to select its master document. In this example, the feature copies styles, margins, the first page, document properties, headers and footers from the master document into the active document.

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article