You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

26 lines
822 B

# 用PowerShell脚本快速修改样式
$word = New-Object -ComObject Word.Application
$doc = $word.Documents.Open("D:\dsWork\ppt-generator-master\left-aligned-template.docx")
$word.Visible = $true
# 修改正文样式
$style = $doc.Styles.Item("正文")
$style.Font.Color = 0 # 黑色 (RGB:0,0,0)
$style.Font.Name = "微软雅黑"
$style.Font.Size = 12
# 修改标题1样式
$heading1 = $doc.Styles.Item("标题 1")
$heading1.ParagraphFormat.Alignment = 1 # 居中对齐
$heading1.Font.Color = 0 # 保持黑色
$heading1.Font.Size = 20
$style.ParagraphFormat.LineSpacingRule = 0 # 单倍行距
$style.ParagraphFormat.SpaceAfter = 6 # 段后间距6磅
$doc.Sections(1).Headers(1).Range.Text = "理想学堂教案"
# 保存并退出
$doc.Save()
$doc.Close()
$word.Quit()