diff --git a/crates/docx/src/read/meta.rs b/crates/docx/src/read/meta.rs
index 9cc23be27..851ecae67 100644
--- a/crates/docx/src/read/meta.rs
+++ b/crates/docx/src/read/meta.rs
@@ -34,6 +34,8 @@ impl Reader<'_> {
"w:linkStyles" => s.link_styles = on_off(k),
"w:removePersonalInformation" => s.remove_personal_info = on_off(k),
"w:removeDateAndTime" => s.remove_date_time = on_off(k),
+ "w:hideSpellingErrors" => s.hide_spelling_errors = on_off(k),
+ "w:hideGrammaticalErrors" => s.hide_grammar_errors = on_off(k),
"w:compat" => {
s.allow_space_of_same_style_in_table = k.child("w:allowSpaceOfSameStyleInTable").is_some_and(on_off);
// Only Word's own setting: another `w:uri` names a different application's.
diff --git a/crates/docx/src/write/settings.rs b/crates/docx/src/write/settings.rs
index 2d97e4a01..a76ded663 100644
--- a/crates/docx/src/write/settings.rs
+++ b/crates/docx/src/write/settings.rs
@@ -54,6 +54,13 @@ pub(super) fn settings_xml(doc: &Document, footnotes: bool, endnotes: bool, temp
if s.gutter_at_top {
w.empty("w:gutterAtTop", &[]);
}
+ // After `w:gutterAtTop` and before `w:proofState` in CT_Settings.
+ if s.hide_spelling_errors {
+ w.empty("w:hideSpellingErrors", &[]);
+ }
+ if s.hide_grammar_errors {
+ w.empty("w:hideGrammaticalErrors", &[]);
+ }
if let Some(id) = template_rel {
w.empty("w:attachedTemplate", &[("r:id", id)]);
}
diff --git a/crates/docx/src/write/settings_merge.rs b/crates/docx/src/write/settings_merge.rs
index 6add6f0eb..ac673c63a 100644
--- a/crates/docx/src/write/settings_merge.rs
+++ b/crates/docx/src/write/settings_merge.rs
@@ -20,6 +20,8 @@ const OWNED: &[&str] = &[
"w:displayBackgroundShape",
"w:mirrorMargins",
"w:gutterAtTop",
+ "w:hideSpellingErrors",
+ "w:hideGrammaticalErrors",
"w:attachedTemplate",
"w:linkStyles",
"w:mailMerge",
diff --git a/crates/docx/tests/it/settings_merge.rs b/crates/docx/tests/it/settings_merge.rs
index 556203f0c..554d53b16 100644
--- a/crates/docx/tests/it/settings_merge.rs
+++ b/crates/docx/tests/it/settings_merge.rs
@@ -204,3 +204,50 @@ fn do_not_track_moves_round_trips() {
assert!(s.contains(""), "{s}");
assert!(!craft_docx::read(&craft_docx::write(&doc).unwrap()).unwrap().settings.track_moves);
}
+
+/// Hide spelling errors and Hide grammar errors in this document only (`w:hideSpellingErrors`,
+/// `w:hideGrammaticalErrors`) are read, written once each (before `w:proofState` in a merged
+/// part), written in a generated part, and left out when they are turned off.
+#[test]
+fn hidden_proofing_errors_round_trip() {
+ let original = SETTINGS.replace("") < pos(&s, ""));
+ assert!(pos(&s, "") < pos(&s, ""), "{s}");
+ assert!(pos(&s, "") < pos(&s, "") && !s.contains("hideSpellingErrors"), "{s}");
+ let back = craft_docx::read(&craft_docx::write(&doc).unwrap()).unwrap();
+ assert!(back.settings.hide_grammar_errors && !back.settings.hide_spelling_errors);
+}
diff --git a/crates/wordmodel/src/settings.rs b/crates/wordmodel/src/settings.rs
index 46faf16c3..d7689fa66 100644
--- a/crates/wordmodel/src/settings.rs
+++ b/crates/wordmodel/src/settings.rs
@@ -170,6 +170,13 @@ pub struct Settings {
/// comments and tracked changes are saved without `w:date`.
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub remove_date_time: bool,
+ /// Hide spelling errors in this document only (`w:hideSpellingErrors`): no squiggles under
+ /// misspelled words. Spelling & Grammar (F7) still finds them.
+ #[serde(skip_serializing_if = "std::ops::Not::not")]
+ pub hide_spelling_errors: bool,
+ /// Hide grammar errors in this document only (`w:hideGrammaticalErrors`).
+ #[serde(skip_serializing_if = "std::ops::Not::not")]
+ pub hide_grammar_errors: bool,
/// The document was opened from ODF: the standard's rules that differ from Word's apply as
/// it is laid out.
#[serde(skip_serializing_if = "Option::is_none")]
@@ -333,6 +340,8 @@ impl Default for Settings {
zoom: None,
remove_personal_info: false,
remove_date_time: false,
+ hide_spelling_errors: false,
+ hide_grammar_errors: false,
odf: None,
}
}