diff --git a/crates/formats/src/odt/forms.rs b/crates/formats/src/odt/forms.rs
index b34a27866f..2501cc5665 100644
--- a/crates/formats/src/odt/forms.rs
+++ b/crates/formats/src/odt/forms.rs
@@ -242,8 +242,9 @@ pub(in crate::odt) fn form_xml(c: &ContentControl, text: &str, id: &str, n: usiz
None => (xml, w, h),
}
};
- // A control kept verbatim, with its new id.
- if !c.form_xml.is_empty() {
+ // A control kept verbatim, with its new id, while it is still the control it was read as
+ // (made another kind, it is written as that).
+ if !c.form_xml.is_empty() && c.kind == (ControlKind::Text { multi_line: false }) {
let end = c.form_xml.find(|ch: char| ch.is_whitespace() || ch == '>')?;
let (head, rest) = (c.form_xml.get(..end)?, c.form_xml.get(end..)?);
return Some(size((format!("{head} xml:id=\"{id}\" form:id=\"{id}\"{rest}"), 72.0, 20.0)));
diff --git a/crates/formats/src/odt/tests_more/forms.rs b/crates/formats/src/odt/tests_more/forms.rs
index f2a4574395..40b0dce3bd 100644
--- a/crates/formats/src/odt/tests_more/forms.rs
+++ b/crates/formats/src/odt/tests_more/forms.rs
@@ -130,6 +130,20 @@ fn buttons_are_kept() {
"{c}"
);
assert!(c.contains(r#"svg:width="72pt" svg:height="21.6pt" draw:control="control1""#), "{c}");
+ // Made a check box, it is saved as one.
+ let mut c = wordcraft_doc::control::ContentControl::new(ControlKind::Text { multi_line: false });
+ c.form_xml = "".into();
+ let kept = crate::odt::forms::form_xml(&c, "Go", "control1", 1).unwrap().0;
+ assert!(kept.starts_with(r#""#), "{kept}");
+ c.kind = ControlKind::CheckBox {
+ checked: true,
+ checked_char: '\u{2612}',
+ checked_font: String::new(),
+ unchecked_char: '\u{2610}',
+ unchecked_font: String::new(),
+ };
+ let made = crate::odt::forms::form_xml(&c, "\u{2612}", "control1", 1).unwrap().0;
+ assert!(made.starts_with("