View Single Post
 
Old 10-27-2020, 03:16 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

When you copy styles, you get everything about those styles in the document. This includes the visibility, priority etc.

You can either configure the styles exactly as you want in the templates so that the settings get imported OR you can run more code to undo the settings you didn't want after you import the styles. For instance, you can hide any styles by setting their .Visibility property to True (yes, it is backwards - .Visibility = True means that the style doesn't appear in your styles list)

Normal is a special built-in style but "underline" and "No-spacing" would be either custom styles (or aliases added to a built-in style depending on your settings).

Note that running two consecutive lines to import styles from two different templates has some gotchas. The following lines would give you all the style definitions from ThisDocument + the aliases and custom styles from NormalTemplate. If the custom styles in NormalTemplate don't exist in ThisDocument BUT they are based on styles that do, then those styles may not appear the same as they do in NormalTemplate.

.CopyStylesFromTemplate (NormalTemplate.FullName)
.CopyStylesFromTemplate (ThisDocument.FullName)

Fiddling the priority settings only make sense if you have chosen to display the styles in that order (by setting options to display list order 'As Recommended'). If you are showing styles in alphabetical order then the style's priority setting is ignored. Also, any style with the same priority level will fall into alphabetical order anyway so just setting Normal to 99 doesn't mean much if all the other styles are also set to 99.
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote