param([Parameter(Mandatory=$true)][string]$OutputPath)
$ErrorActionPreference='Stop'
$word=New-Object -ComObject Word.Application
$word.Visible=$false
$word.DisplayAlerts=0
try {
  $doc=$word.Documents.Add()
  try {
    $doc.PageSetup.PaperSize=2
    $doc.PageSetup.TopMargin=$word.InchesToPoints(0.85)
    $doc.PageSetup.BottomMargin=$word.InchesToPoints(0.8)
    $doc.PageSetup.LeftMargin=$word.InchesToPoints(0.9)
    $doc.PageSetup.RightMargin=$word.InchesToPoints(0.9)
    $normal=$doc.Styles.Item(-1)
    $normal.Font.Name='Calibri'; $normal.Font.NameFarEast='Microsoft YaHei'; $normal.Font.Size=10.5
    $normal.ParagraphFormat.SpaceAfter=6; $normal.ParagraphFormat.LineSpacingRule=5; $normal.ParagraphFormat.LineSpacing=15
    $title=$doc.Styles.Item(-63)
    $title.Font.Name='Calibri'; $title.Font.NameFarEast='Microsoft YaHei'; $title.Font.Size=25; $title.Font.Bold=$true; $title.Font.Color=9655585
    $title.ParagraphFormat.Alignment=1; $title.ParagraphFormat.SpaceBefore=100; $title.ParagraphFormat.SpaceAfter=12
    $subtitle=$doc.Styles.Item(-75)
    $subtitle.Font.Name='Calibri'; $subtitle.Font.NameFarEast='Microsoft YaHei'; $subtitle.Font.Size=14; $subtitle.Font.Color=8421504
    $subtitle.ParagraphFormat.Alignment=1; $subtitle.ParagraphFormat.SpaceAfter=24
    foreach($pair in @(@(-2,16,16,8,11621185),@(-3,13,12,6,11621185),@(-4,11.5,9,4,9655585))){
      $s=$doc.Styles.Item($pair[0]); $s.Font.Name='Calibri'; $s.Font.NameFarEast='Microsoft YaHei'; $s.Font.Size=$pair[1]; $s.Font.Bold=$true; $s.Font.Color=$pair[4]
      $s.ParagraphFormat.SpaceBefore=$pair[2]; $s.ParagraphFormat.SpaceAfter=$pair[3]; $s.ParagraphFormat.KeepWithNext=$true
    }
    $doc.SaveAs2($OutputPath,16)
  } finally { $doc.Close($true); [Runtime.InteropServices.Marshal]::ReleaseComObject($doc)|Out-Null }
} finally { $word.Quit(); [Runtime.InteropServices.Marshal]::ReleaseComObject($word)|Out-Null }
