Support adjust line height in table (#522)
* fix: support adjust_line_height_in_table in settings * fix: read adjust in table * fixmain
parent
753c6d4d7e
commit
b4be4bbe9b
|
@ -13,6 +13,7 @@ pub struct Settings {
|
||||||
doc_id: Option<DocId>,
|
doc_id: Option<DocId>,
|
||||||
doc_vars: Vec<DocVar>,
|
doc_vars: Vec<DocVar>,
|
||||||
even_and_odd_headers: bool,
|
even_and_odd_headers: bool,
|
||||||
|
adjust_line_height_in_table: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Settings {
|
impl Settings {
|
||||||
|
@ -39,6 +40,11 @@ impl Settings {
|
||||||
self.even_and_odd_headers = true;
|
self.even_and_odd_headers = true;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn adjust_line_height_in_table(mut self) -> Self {
|
||||||
|
self.adjust_line_height_in_table = true;
|
||||||
|
self
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for Settings {
|
impl Default for Settings {
|
||||||
|
@ -49,6 +55,7 @@ impl Default for Settings {
|
||||||
doc_id: None,
|
doc_id: None,
|
||||||
doc_vars: vec![],
|
doc_vars: vec![],
|
||||||
even_and_odd_headers: false,
|
even_and_odd_headers: false,
|
||||||
|
adjust_line_height_in_table: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -66,8 +73,13 @@ impl BuildXML for Settings {
|
||||||
.balance_single_byte_double_byte_width()
|
.balance_single_byte_double_byte_width()
|
||||||
.do_not_leave_backslash_alone()
|
.do_not_leave_backslash_alone()
|
||||||
.ul_trail_space()
|
.ul_trail_space()
|
||||||
.do_not_expand_shift_return()
|
.do_not_expand_shift_return();
|
||||||
.adjust_line_height_table()
|
|
||||||
|
if self.adjust_line_height_in_table {
|
||||||
|
b = b.adjust_line_height_table();
|
||||||
|
}
|
||||||
|
|
||||||
|
b = b
|
||||||
.use_fe_layout()
|
.use_fe_layout()
|
||||||
.compat_setting(
|
.compat_setting(
|
||||||
"compatibilityMode",
|
"compatibilityMode",
|
||||||
|
@ -138,7 +150,6 @@ mod tests {
|
||||||
<w:doNotLeaveBackslashAlone />
|
<w:doNotLeaveBackslashAlone />
|
||||||
<w:ulTrailSpace />
|
<w:ulTrailSpace />
|
||||||
<w:doNotExpandShiftReturn />
|
<w:doNotExpandShiftReturn />
|
||||||
<w:adjustLineHeightInTable />
|
|
||||||
<w:useFELayout />
|
<w:useFELayout />
|
||||||
<w:compatSetting w:name="compatibilityMode" w:uri="http://schemas.microsoft.com/office/word" w:val="15" />
|
<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="overrideTableStyleFontSizeAndJustification" w:uri="http://schemas.microsoft.com/office/word" w:val="1" />
|
||||||
|
|
|
@ -49,6 +49,9 @@ impl FromXML for Settings {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
XMLElement::AdjustLineHeightInTable => {
|
||||||
|
settings = settings.adjust_line_height_in_table();
|
||||||
|
}
|
||||||
_ => {}
|
_ => {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -140,6 +140,7 @@ pub enum XMLElement {
|
||||||
DocDefaults,
|
DocDefaults,
|
||||||
DefaultTabStop,
|
DefaultTabStop,
|
||||||
RunPropertyDefault,
|
RunPropertyDefault,
|
||||||
|
AdjustLineHeightInTable,
|
||||||
SectionProperty,
|
SectionProperty,
|
||||||
PageSize,
|
PageSize,
|
||||||
PageMargin,
|
PageMargin,
|
||||||
|
@ -353,6 +354,7 @@ impl FromStr for XMLElement {
|
||||||
"docDefaults" => Ok(XMLElement::DocDefaults),
|
"docDefaults" => Ok(XMLElement::DocDefaults),
|
||||||
"docGrid" => Ok(XMLElement::DocGrid),
|
"docGrid" => Ok(XMLElement::DocGrid),
|
||||||
"rPrDefault" => Ok(XMLElement::RunPropertyDefault),
|
"rPrDefault" => Ok(XMLElement::RunPropertyDefault),
|
||||||
|
"adjustLineHeightInTable" => Ok(XMLElement::AdjustLineHeightInTable),
|
||||||
"defaultTabStop" => Ok(XMLElement::DefaultTabStop),
|
"defaultTabStop" => Ok(XMLElement::DefaultTabStop),
|
||||||
"divId" => Ok(XMLElement::DivId),
|
"divId" => Ok(XMLElement::DivId),
|
||||||
"div" => Ok(XMLElement::Div),
|
"div" => Ok(XMLElement::Div),
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -56,6 +56,7 @@ export type SettingsJSON = {
|
||||||
// w15:docId
|
// w15:docId
|
||||||
docId: string | null;
|
docId: string | null;
|
||||||
defaultTabStop: number;
|
defaultTabStop: number;
|
||||||
|
adjustLineHeightInTable: boolean;
|
||||||
zoom: number;
|
zoom: number;
|
||||||
docVars: { name: string; val: string }[];
|
docVars: { name: string; val: string }[];
|
||||||
};
|
};
|
||||||
|
|
|
@ -82,6 +82,11 @@ impl Docx {
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn set_adjust_line_height_in_table(mut self) -> Self {
|
||||||
|
self.0.settings = self.0.settings.adjust_line_height_in_table();
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
pub fn header(mut self, header: Header) -> Self {
|
pub fn header(mut self, header: Header) -> Self {
|
||||||
self.0 = self.0.header(header.take());
|
self.0 = self.0.header(header.take());
|
||||||
self
|
self
|
||||||
|
|
|
@ -579,6 +579,7 @@ Object {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"settings": Object {
|
"settings": Object {
|
||||||
|
"adjustLineHeightInTable": true,
|
||||||
"defaultTabStop": 840,
|
"defaultTabStop": 840,
|
||||||
"docId": "FB0AE6E2-8FB8-3345-A8FC-78CE6F3ABE4E",
|
"docId": "FB0AE6E2-8FB8-3345-A8FC-78CE6F3ABE4E",
|
||||||
"docVars": Array [],
|
"docVars": Array [],
|
||||||
|
@ -1441,6 +1442,7 @@ Object {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"settings": Object {
|
"settings": Object {
|
||||||
|
"adjustLineHeightInTable": true,
|
||||||
"defaultTabStop": 840,
|
"defaultTabStop": 840,
|
||||||
"docId": null,
|
"docId": null,
|
||||||
"docVars": Array [],
|
"docVars": Array [],
|
||||||
|
@ -2674,6 +2676,7 @@ Object {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"settings": Object {
|
"settings": Object {
|
||||||
|
"adjustLineHeightInTable": true,
|
||||||
"defaultTabStop": 840,
|
"defaultTabStop": 840,
|
||||||
"docId": "3A5F0B6E-9417-4662-A075-C7869185C909",
|
"docId": "3A5F0B6E-9417-4662-A075-C7869185C909",
|
||||||
"docVars": Array [],
|
"docVars": Array [],
|
||||||
|
@ -4215,6 +4218,7 @@ Object {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"settings": Object {
|
"settings": Object {
|
||||||
|
"adjustLineHeightInTable": true,
|
||||||
"defaultTabStop": 840,
|
"defaultTabStop": 840,
|
||||||
"docId": "A1898E6C-1AED-3C4D-9CCF-C24208DA732E",
|
"docId": "A1898E6C-1AED-3C4D-9CCF-C24208DA732E",
|
||||||
"docVars": Array [],
|
"docVars": Array [],
|
||||||
|
@ -5521,6 +5525,7 @@ Object {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"settings": Object {
|
"settings": Object {
|
||||||
|
"adjustLineHeightInTable": true,
|
||||||
"defaultTabStop": 709,
|
"defaultTabStop": 709,
|
||||||
"docId": "50d61cff-8055-4197-917b-3993d0243c46",
|
"docId": "50d61cff-8055-4197-917b-3993d0243c46",
|
||||||
"docVars": Array [],
|
"docVars": Array [],
|
||||||
|
@ -5883,6 +5888,7 @@ Object {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"settings": Object {
|
"settings": Object {
|
||||||
|
"adjustLineHeightInTable": true,
|
||||||
"defaultTabStop": 840,
|
"defaultTabStop": 840,
|
||||||
"docId": "4A9883C0-7AEC-574E-926D-DA6DB000DD90",
|
"docId": "4A9883C0-7AEC-574E-926D-DA6DB000DD90",
|
||||||
"docVars": Array [],
|
"docVars": Array [],
|
||||||
|
@ -7202,6 +7208,7 @@ Object {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"settings": Object {
|
"settings": Object {
|
||||||
|
"adjustLineHeightInTable": true,
|
||||||
"defaultTabStop": 840,
|
"defaultTabStop": 840,
|
||||||
"docId": "60C41423-192A-BA49-94E6-2051A402BFCA",
|
"docId": "60C41423-192A-BA49-94E6-2051A402BFCA",
|
||||||
"docVars": Array [],
|
"docVars": Array [],
|
||||||
|
@ -10197,6 +10204,7 @@ Object {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"settings": Object {
|
"settings": Object {
|
||||||
|
"adjustLineHeightInTable": true,
|
||||||
"defaultTabStop": 840,
|
"defaultTabStop": 840,
|
||||||
"docId": "E43E077A-3477-A242-BD53-4313974E06A2",
|
"docId": "E43E077A-3477-A242-BD53-4313974E06A2",
|
||||||
"docVars": Array [],
|
"docVars": Array [],
|
||||||
|
@ -11086,6 +11094,7 @@ Object {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"settings": Object {
|
"settings": Object {
|
||||||
|
"adjustLineHeightInTable": true,
|
||||||
"defaultTabStop": 840,
|
"defaultTabStop": 840,
|
||||||
"docId": "B1317C39-ACCF-5B4D-BE97-FD2D73F14B00",
|
"docId": "B1317C39-ACCF-5B4D-BE97-FD2D73F14B00",
|
||||||
"docVars": Array [],
|
"docVars": Array [],
|
||||||
|
@ -12728,6 +12737,7 @@ Object {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"settings": Object {
|
"settings": Object {
|
||||||
|
"adjustLineHeightInTable": true,
|
||||||
"defaultTabStop": 840,
|
"defaultTabStop": 840,
|
||||||
"docId": "1D08889F-3E41-C046-8805-654C0B247DE3",
|
"docId": "1D08889F-3E41-C046-8805-654C0B247DE3",
|
||||||
"docVars": Array [],
|
"docVars": Array [],
|
||||||
|
@ -14275,6 +14285,7 @@ Object {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"settings": Object {
|
"settings": Object {
|
||||||
|
"adjustLineHeightInTable": true,
|
||||||
"defaultTabStop": 840,
|
"defaultTabStop": 840,
|
||||||
"docId": "932EBF18-9F5F-C245-A499-C2EB430024C4",
|
"docId": "932EBF18-9F5F-C245-A499-C2EB430024C4",
|
||||||
"docVars": Array [],
|
"docVars": Array [],
|
||||||
|
@ -15207,6 +15218,7 @@ Object {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"settings": Object {
|
"settings": Object {
|
||||||
|
"adjustLineHeightInTable": true,
|
||||||
"defaultTabStop": 840,
|
"defaultTabStop": 840,
|
||||||
"docId": null,
|
"docId": null,
|
||||||
"docVars": Array [],
|
"docVars": Array [],
|
||||||
|
@ -16384,6 +16396,7 @@ Object {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"settings": Object {
|
"settings": Object {
|
||||||
|
"adjustLineHeightInTable": true,
|
||||||
"defaultTabStop": 840,
|
"defaultTabStop": 840,
|
||||||
"docId": "10BE20B6-DCA9-7441-B548-606D7D9EDD92",
|
"docId": "10BE20B6-DCA9-7441-B548-606D7D9EDD92",
|
||||||
"docVars": Array [],
|
"docVars": Array [],
|
||||||
|
@ -18570,6 +18583,7 @@ Object {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"settings": Object {
|
"settings": Object {
|
||||||
|
"adjustLineHeightInTable": true,
|
||||||
"defaultTabStop": 709,
|
"defaultTabStop": 709,
|
||||||
"docId": "70F68831-609A-4ACC-87CE-416E9D216976",
|
"docId": "70F68831-609A-4ACC-87CE-416E9D216976",
|
||||||
"docVars": Array [
|
"docVars": Array [
|
||||||
|
@ -20337,6 +20351,7 @@ Object {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"settings": Object {
|
"settings": Object {
|
||||||
|
"adjustLineHeightInTable": true,
|
||||||
"defaultTabStop": 840,
|
"defaultTabStop": 840,
|
||||||
"docId": "A8BB00BC-8D6F-2840-B682-9341438874CF",
|
"docId": "A8BB00BC-8D6F-2840-B682-9341438874CF",
|
||||||
"docVars": Array [],
|
"docVars": Array [],
|
||||||
|
@ -22151,6 +22166,7 @@ Object {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"settings": Object {
|
"settings": Object {
|
||||||
|
"adjustLineHeightInTable": true,
|
||||||
"defaultTabStop": 840,
|
"defaultTabStop": 840,
|
||||||
"docId": "F952540B-8E26-9040-BEAB-F11A2F10B576",
|
"docId": "F952540B-8E26-9040-BEAB-F11A2F10B576",
|
||||||
"docVars": Array [],
|
"docVars": Array [],
|
||||||
|
@ -24652,6 +24668,7 @@ Object {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"settings": Object {
|
"settings": Object {
|
||||||
|
"adjustLineHeightInTable": true,
|
||||||
"defaultTabStop": 840,
|
"defaultTabStop": 840,
|
||||||
"docId": "D69B5D79-AA39-424E-9D58-EF8E35CE7D20",
|
"docId": "D69B5D79-AA39-424E-9D58-EF8E35CE7D20",
|
||||||
"docVars": Array [],
|
"docVars": Array [],
|
||||||
|
@ -25687,6 +25704,7 @@ Object {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"settings": Object {
|
"settings": Object {
|
||||||
|
"adjustLineHeightInTable": true,
|
||||||
"defaultTabStop": 840,
|
"defaultTabStop": 840,
|
||||||
"docId": "F963E3C9-F24C-354B-A852-391D33A55DB4",
|
"docId": "F963E3C9-F24C-354B-A852-391D33A55DB4",
|
||||||
"docVars": Array [],
|
"docVars": Array [],
|
||||||
|
@ -34835,6 +34853,7 @@ Object {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"settings": Object {
|
"settings": Object {
|
||||||
|
"adjustLineHeightInTable": false,
|
||||||
"defaultTabStop": 720,
|
"defaultTabStop": 720,
|
||||||
"docId": "D4D4776C-D5E8-4FE1-8892-3B40BC54EF41",
|
"docId": "D4D4776C-D5E8-4FE1-8892-3B40BC54EF41",
|
||||||
"docVars": Array [],
|
"docVars": Array [],
|
||||||
|
@ -45549,6 +45568,7 @@ Object {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"settings": Object {
|
"settings": Object {
|
||||||
|
"adjustLineHeightInTable": true,
|
||||||
"defaultTabStop": 840,
|
"defaultTabStop": 840,
|
||||||
"docId": "C272B628-6DE8-264A-8734-9D2219FFD42F",
|
"docId": "C272B628-6DE8-264A-8734-9D2219FFD42F",
|
||||||
"docVars": Array [],
|
"docVars": Array [],
|
||||||
|
@ -46567,6 +46587,7 @@ Object {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"settings": Object {
|
"settings": Object {
|
||||||
|
"adjustLineHeightInTable": true,
|
||||||
"defaultTabStop": 840,
|
"defaultTabStop": 840,
|
||||||
"docId": "C11ED300-8EA6-3D41-8D67-5E5DE3410CF8",
|
"docId": "C11ED300-8EA6-3D41-8D67-5E5DE3410CF8",
|
||||||
"docVars": Array [],
|
"docVars": Array [],
|
||||||
|
@ -48766,6 +48787,7 @@ Object {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"settings": Object {
|
"settings": Object {
|
||||||
|
"adjustLineHeightInTable": true,
|
||||||
"defaultTabStop": 840,
|
"defaultTabStop": 840,
|
||||||
"docId": "A3F1E202-8404-D445-9EDD-BBC3885575A6",
|
"docId": "A3F1E202-8404-D445-9EDD-BBC3885575A6",
|
||||||
"docVars": Array [],
|
"docVars": Array [],
|
||||||
|
@ -52395,6 +52417,7 @@ Object {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"settings": Object {
|
"settings": Object {
|
||||||
|
"adjustLineHeightInTable": true,
|
||||||
"defaultTabStop": 840,
|
"defaultTabStop": 840,
|
||||||
"docId": "9F52F717-3F03-584C-ACEF-96E0106FA905",
|
"docId": "9F52F717-3F03-584C-ACEF-96E0106FA905",
|
||||||
"docVars": Array [],
|
"docVars": Array [],
|
||||||
|
@ -53413,6 +53436,7 @@ Object {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"settings": Object {
|
"settings": Object {
|
||||||
|
"adjustLineHeightInTable": true,
|
||||||
"defaultTabStop": 840,
|
"defaultTabStop": 840,
|
||||||
"docId": "7501A506-09EA-0F4C-ACFF-789B81CBED2D",
|
"docId": "7501A506-09EA-0F4C-ACFF-789B81CBED2D",
|
||||||
"docVars": Array [],
|
"docVars": Array [],
|
||||||
|
@ -62866,6 +62890,7 @@ Object {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
"settings": Object {
|
"settings": Object {
|
||||||
|
"adjustLineHeightInTable": true,
|
||||||
"defaultTabStop": 420,
|
"defaultTabStop": 420,
|
||||||
"docId": "A426FE01-5E89-4BAE-8422-F2CC8611EC68",
|
"docId": "A426FE01-5E89-4BAE-8422-F2CC8611EC68",
|
||||||
"docVars": Array [],
|
"docVars": Array [],
|
||||||
|
|
Loading…
Reference in New Issue