diff --git a/data/templates/default.openxml b/data/templates/default.openxml
index 0cfc6e1a20a4..000609df707d 100644
--- a/data/templates/default.openxml
+++ b/data/templates/default.openxml
@@ -4,7 +4,7 @@
$if(title)$
-
+
$title$
@@ -12,7 +12,7 @@ $endif$
$if(subtitle)$
-
+
$subtitle$
@@ -20,7 +20,7 @@ $endif$
$for(author)$
-
+
$author$
@@ -28,7 +28,7 @@ $endfor$
$if(date)$
-
+
$date$
@@ -37,7 +37,7 @@ $if(abstract)$
$if(abstract-title)$
-
+
$abstract-title$
diff --git a/src/Text/Pandoc/Writers/Docx/OpenXML.hs b/src/Text/Pandoc/Writers/Docx/OpenXML.hs
index e3900f32f1a3..6713d9c07b32 100644
--- a/src/Text/Pandoc/Writers/Docx/OpenXML.hs
+++ b/src/Text/Pandoc/Writers/Docx/OpenXML.hs
@@ -286,6 +286,8 @@ writeOpenXML opts (Pandoc meta blocks) = do
(fmap (vcat . map (literal . showContent)) . blocksToOpenXML opts)
(fmap (hcat . map (literal . showContent)) . inlinesToOpenXML opts)
meta
+ cStyleMap <- gets (smParaStyle . stStyleMaps)
+ let styleIdOf name = fromStyleId $ getStyleIdFromName name cStyleMap
let context = resetField "body" body
. resetField "toc"
(vcat (map (literal . showElement) toc))
@@ -299,6 +301,12 @@ writeOpenXML opts (Pandoc meta blocks) = do
. resetField "date" date
. resetField "abstract-title" abstractTitle
. resetField "abstract" abstract
+ . resetField "title-style-id" (styleIdOf "Title")
+ . resetField "subtitle-style-id" (styleIdOf "Subtitle")
+ . resetField "author-style-id" (styleIdOf "Author")
+ . resetField "date-style-id" (styleIdOf "Date")
+ . resetField "abstract-title-style-id" (styleIdOf "AbstractTitle")
+ . resetField "abstract-style-id" (styleIdOf "Abstract")
$ metadata
tpl <- maybe (lift $ compileDefaultTemplate "openxml") pure $ writerTemplate opts
let rendered = render Nothing $ renderTemplate tpl context