feat: Add word compat to settings (#166)

main
bokuweb 2020-10-10 09:50:22 +09:00 committed by GitHub
parent 63370decff
commit 043da9fb23
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 75 additions and 1 deletions

View File

@ -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#"<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:settings xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml"><w:defaultTabStop w:val="709" /><w:zoom w:percent="100" /></w:settings>"#
<w:settings xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml"><w:defaultTabStop w:val="709" /><w:zoom w:percent="100" /><w:compat>
<spaceForUL />
<balanceSingleByteDoubleByteWidth />
<doNotLeaveBackslashAlone />
<ulTrailSpace />
<doNotExpandShiftReturn />
<adjustLineHeightInTable />
<useFELayout />
<w:compatSetting w:name="compatibilityMode" w:uri="http://schemas.microsoft.com/office/word" w:val="15" />
<w:compatSetting w:name="overrideTableStyleFontSizeAndJustification" w:uri="http://schemas.microsoft.com/office/word" w:val="1" />
<w:compatSetting w:name="enableOpenTypeFeatures" w:uri="http://schemas.microsoft.com/office/word" w:val="1" />
<w:compatSetting w:name="doNotFlipMirrorIndents" w:uri="http://schemas.microsoft.com/office/word" w:val="1" />
<w:compatSetting w:name="differentiateMultirowTableHeaders" w:uri="http://schemas.microsoft.com/office/word" w:val="1" />
<w:compatSetting w:name="useWord2013TrackBottomHyphenation" w:uri="http://schemas.microsoft.com/office/word" w:val="0" />
</w:compat>
</w:settings>"#
);
}
}

View File

@ -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"
);
/*
<w:lvlOverride w:ilvl="0">
<w:startOverride w:val="1"/>