From 57641ecd7d7a7d5d6d48fbb46ec0f88fb55e967d Mon Sep 17 00:00:00 2001
From: Veronica Berglyd Olsen <1619840+vkbo@users.noreply.github.com>
Date: Wed, 13 Nov 2024 20:50:47 +0100
Subject: [PATCH] Make page number work with Office 365
---
novelwriter/formats/todocx.py | 4 +---
tests/reference/fmtToDocX_SaveDocument_header1.xml | 5 +----
2 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/novelwriter/formats/todocx.py b/novelwriter/formats/todocx.py
index 42d42bc5..1a9af220 100644
--- a/novelwriter/formats/todocx.py
+++ b/novelwriter/formats/todocx.py
@@ -855,12 +855,10 @@ class ToDocX(Tokenizer):
xR = xmlSubElem(xP, _wTag("r"))
xmlSubElem(xR, _wTag("fldChar"), attrib={wFldCT: "begin"})
xR = xmlSubElem(xP, _wTag("r"))
- _wText(xR, " PAGE ")
+ xmlSubElem(xR, _wTag("instrText"), "PAGE", attrib={_mkTag("xml", "space"): "preserve"})
xR = xmlSubElem(xP, _wTag("r"))
xmlSubElem(xR, _wTag("fldChar"), attrib={wFldCT: "separate"})
xR = xmlSubElem(xP, _wTag("r"))
- _wText(xR, "0")
- xR = xmlSubElem(xP, _wTag("r"))
xmlSubElem(xR, _wTag("fldChar"), attrib={wFldCT: "end"})
if post:
xR = xmlSubElem(xP, _wTag("r"))
diff --git a/tests/reference/fmtToDocX_SaveDocument_header1.xml b/tests/reference/fmtToDocX_SaveDocument_header1.xml
index 1135d853..4acc8f9e 100644
--- a/tests/reference/fmtToDocX_SaveDocument_header1.xml
+++ b/tests/reference/fmtToDocX_SaveDocument_header1.xml
@@ -13,14 +13,11 @@
- PAGE
+ PAGE
-
- 0
-