Created
January 26, 2026 09:20
-
-
Save eugrus/405efb77f37db2e628d2bf5677980e38 to your computer and use it in GitHub Desktop.
reformat built-in Word heading styles
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $word = [Runtime.InteropServices.Marshal]::GetActiveObject("Word.Application") | |
| $doc = $word.ActiveDocument | |
| $headingStyles = 1..9 | ForEach-Object { -1 * $_ } # built-in Word heading styles (wdStyleHeading1 = -1 … wdStyleHeading9 = -9) | |
| foreach ($styleId in $headingStyles) { | |
| $style = $doc.Styles.Item($styleId) | |
| $style.Font.Name = "Arial" | |
| $style.Font.Size = 11 | |
| $style.Font.Color = 0 # wdColorBlack | |
| $style.ParagraphFormat.LineSpacingRule = 3 # wdLineSpace1pt5 | |
| $style.ParagraphFormat.SpaceBefore = 0 | |
| $style.ParagraphFormat.SpaceAfter = 0 | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment