diff --git a/docx-core/src/documents/settings.rs b/docx-core/src/documents/settings.rs index 45d4a91..dedadf7 100644 --- a/docx-core/src/documents/settings.rs +++ b/docx-core/src/documents/settings.rs @@ -41,6 +41,45 @@ impl BuildXML for Settings { .open_settings() .add_child(&self.default_tab_stop) .add_child(&self.zoom) + .open_compat() + .space_for_ul() + .balance_single_byte_double_byte_width() + .do_not_leave_backslash_alone() + .ul_trail_space() + .do_not_expand_shift_return() + .adjust_line_height_table() + .use_fe_layout() + .compat_setting( + "compatibilityMode", + "http://schemas.microsoft.com/office/word", + "15", + ) + .compat_setting( + "overrideTableStyleFontSizeAndJustification", + "http://schemas.microsoft.com/office/word", + "1", + ) + .compat_setting( + "enableOpenTypeFeatures", + "http://schemas.microsoft.com/office/word", + "1", + ) + .compat_setting( + "doNotFlipMirrorIndents", + "http://schemas.microsoft.com/office/word", + "1", + ) + .compat_setting( + "differentiateMultirowTableHeaders", + "http://schemas.microsoft.com/office/word", + "1", + ) + .compat_setting( + "useWord2013TrackBottomHyphenation", + "http://schemas.microsoft.com/office/word", + "0", + ) + .close() .add_optional_child(&self.doc_id) .close() .build() @@ -62,7 +101,22 @@ mod tests { assert_eq!( str::from_utf8(&b).unwrap(), r#" -"# + + + + + + + + + + + + + + + +"# ); } } diff --git a/docx-core/src/xml_builder/elements.rs b/docx-core/src/xml_builder/elements.rs index 715b95d..c9cff43 100644 --- a/docx-core/src/xml_builder/elements.rs +++ b/docx-core/src/xml_builder/elements.rs @@ -256,6 +256,26 @@ impl XMLBuilder { open!(open_wp_text_box, "wps:txbx"); open!(open_text_box_content, "w:txbxContent"); + // compat + open!(open_compat, "w:compat"); + closed!(space_for_ul, "spaceForUL"); + closed!( + balance_single_byte_double_byte_width, + "balanceSingleByteDoubleByteWidth" + ); + closed!(do_not_leave_backslash_alone, "doNotLeaveBackslashAlone"); + closed!(ul_trail_space, "ulTrailSpace"); + closed!(do_not_expand_shift_return, "doNotExpandShiftReturn"); + closed!(adjust_line_height_table, "adjustLineHeightInTable"); + closed!(use_fe_layout, "useFELayout"); + closed!( + compat_setting, + "w:compatSetting", + "w:name", + "w:uri", + "w:val" + ); + /*