fix: change pStyle dfefault to null (#72)

main
bokuweb 2020-05-27 20:43:25 +09:00 committed by GitHub
parent c12ca9d042
commit 7556154bd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
40 changed files with 66 additions and 70 deletions

View File

@ -107,7 +107,7 @@ mod tests {
str::from_utf8(&b).unwrap(), str::from_utf8(&b).unwrap(),
r#"<?xml version="1.0" encoding="UTF-8" standalone="yes"?> r#"<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<w:document xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" mc:Ignorable="w14 wp14"> <w:document xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" mc:Ignorable="w14 wp14">
<w:body><w:p><w:pPr><w:pStyle w:val="Normal" /><w:rPr /></w:pPr><w:r><w:rPr /><w:t xml:space="preserve">Hello</w:t></w:r></w:p><w:sectPr><w:pgSz w:w="11906" w:h="16838" /><w:pgMar w:top="1985" w:right="1701" w:bottom="1701" w:left="1701" w:header="851" w:footer="992" w:gutter="0" /><w:cols w:space="425" /> <w:body><w:p><w:pPr><w:rPr /></w:pPr><w:r><w:rPr /><w:t xml:space="preserve">Hello</w:t></w:r></w:p><w:sectPr><w:pgSz w:w="11906" w:h="16838" /><w:pgMar w:top="1985" w:right="1701" w:bottom="1701" w:left="1701" w:header="851" w:footer="992" w:gutter="0" /><w:cols w:space="425" />
<w:docGrid w:type="lines" w:linePitch="360" /> <w:docGrid w:type="lines" w:linePitch="360" />
</w:sectPr></w:body> </w:sectPr></w:body>
</w:document>"# </w:document>"#

View File

@ -59,7 +59,7 @@ mod tests {
); );
assert_eq!( assert_eq!(
serde_json::to_string(&graphic).unwrap(), serde_json::to_string(&graphic).unwrap(),
r#"{"children":[{"dataType":"wpShape","children":[{"type":"shape","data":{"children":[{"type":"textbox","data":{"children":[{"children":[{"type":"paragraph","data":{"children":[{"type":"run","data":{"runProperty":{"sz":null,"szCs":null,"color":null,"highlight":null,"underline":null,"bold":null,"boldCs":null,"italic":null,"italicCs":null,"vanish":null},"children":[{"type":"text","data":{"preserveSpace":true,"text":"pattern1"}}]}}],"property":{"runProperty":{"sz":null,"szCs":null,"color":null,"highlight":null,"underline":null,"bold":null,"boldCs":null,"italic":null,"italicCs":null,"vanish":null},"style":"Normal","numberingProperty":null,"alignment":null,"indent":null},"hasNumbering":false,"attrs":[]}}],"has_numbering":false}],"hasNumbering":false}}]}}]}]}"# r#"{"children":[{"dataType":"wpShape","children":[{"type":"shape","data":{"children":[{"type":"textbox","data":{"children":[{"children":[{"type":"paragraph","data":{"children":[{"type":"run","data":{"runProperty":{"sz":null,"szCs":null,"color":null,"highlight":null,"underline":null,"bold":null,"boldCs":null,"italic":null,"italicCs":null,"vanish":null},"children":[{"type":"text","data":{"preserveSpace":true,"text":"pattern1"}}]}}],"property":{"runProperty":{"sz":null,"szCs":null,"color":null,"highlight":null,"underline":null,"bold":null,"boldCs":null,"italic":null,"italicCs":null,"vanish":null},"style":null,"numberingProperty":null,"alignment":null,"indent":null},"hasNumbering":false,"attrs":[]}}],"has_numbering":false}],"hasNumbering":false}}]}}]}]}"#
); );
} }
} }

View File

@ -72,7 +72,7 @@ mod tests {
let b = c.build(); let b = c.build();
assert_eq!( assert_eq!(
str::from_utf8(&b).unwrap(), str::from_utf8(&b).unwrap(),
r#"<w:abstractNum w:abstractNumId="0"><w:lvl w:ilvl="1"><w:start w:val="1" /><w:numFmt w:val="decimal" /><w:lvlText w:val="%4." /><w:lvlJc w:val="left" /><w:pPr><w:pStyle w:val="Normal" /><w:rPr /></w:pPr></w:lvl></w:abstractNum>"# r#"<w:abstractNum w:abstractNumId="0"><w:lvl w:ilvl="1"><w:start w:val="1" /><w:numFmt w:val="decimal" /><w:lvlText w:val="%4." /><w:lvlJc w:val="left" /><w:pPr><w:rPr /></w:pPr></w:lvl></w:abstractNum>"#
); );
} }
@ -90,7 +90,7 @@ mod tests {
.num_style_link("style1"); .num_style_link("style1");
assert_eq!( assert_eq!(
serde_json::to_string(&c).unwrap(), serde_json::to_string(&c).unwrap(),
r#"{"id":0,"styleLink":null,"numStyleLink":"style1","levels":[{"level":1,"start":1,"format":"decimal","text":"%4.","jc":"left","pstyle":null,"paragraphProperty":{"runProperty":{"sz":null,"szCs":null,"color":null,"highlight":null,"underline":null,"bold":null,"boldCs":null,"italic":null,"italicCs":null,"vanish":null},"style":"Normal","numberingProperty":null,"alignment":null,"indent":null}}]}"# r#"{"id":0,"styleLink":null,"numStyleLink":"style1","levels":[{"level":1,"start":1,"format":"decimal","text":"%4.","jc":"left","pstyle":null,"paragraphProperty":{"runProperty":{"sz":null,"szCs":null,"color":null,"highlight":null,"underline":null,"bold":null,"boldCs":null,"italic":null,"italicCs":null,"vanish":null},"style":null,"numberingProperty":null,"alignment":null,"indent":null}}]}"#
); );
} }
} }

View File

@ -73,7 +73,7 @@ mod tests {
let b = Comment::new(1).build(); let b = Comment::new(1).build();
assert_eq!( assert_eq!(
str::from_utf8(&b).unwrap(), str::from_utf8(&b).unwrap(),
r#"<w:comment w:id="1" w:author="unnamed" w:date="1970-01-01T00:00:00Z" w:initials=""><w:p><w:pPr><w:pStyle w:val="Normal" /><w:rPr /></w:pPr></w:p></w:comment>"# r#"<w:comment w:id="1" w:author="unnamed" w:date="1970-01-01T00:00:00Z" w:initials=""><w:p><w:pPr><w:rPr /></w:pPr></w:p></w:comment>"#
); );
} }
} }

View File

@ -88,7 +88,7 @@ mod tests {
.build(); .build();
assert_eq!( assert_eq!(
str::from_utf8(&b).unwrap(), str::from_utf8(&b).unwrap(),
r#"<w:lvl w:ilvl="1"><w:start w:val="1" /><w:numFmt w:val="decimal" /><w:lvlText w:val="%4." /><w:lvlJc w:val="left" /><w:pPr><w:pStyle w:val="Normal" /><w:rPr /></w:pPr></w:lvl>"# r#"<w:lvl w:ilvl="1"><w:start w:val="1" /><w:numFmt w:val="decimal" /><w:lvlText w:val="%4." /><w:lvlJc w:val="left" /><w:pPr><w:rPr /></w:pPr></w:lvl>"#
); );
} }
@ -105,7 +105,7 @@ mod tests {
.build(); .build();
assert_eq!( assert_eq!(
str::from_utf8(&b).unwrap(), str::from_utf8(&b).unwrap(),
r#"<w:lvl w:ilvl="1"><w:start w:val="1" /><w:numFmt w:val="decimal" /><w:lvlText w:val="%4." /><w:lvlJc w:val="left" /><w:pPr><w:pStyle w:val="Normal" /><w:rPr /><w:ind w:left="320" w:right="0" w:hanging="200" /></w:pPr></w:lvl>"# r#"<w:lvl w:ilvl="1"><w:start w:val="1" /><w:numFmt w:val="decimal" /><w:lvlText w:val="%4." /><w:lvlJc w:val="left" /><w:pPr><w:rPr /><w:ind w:left="320" w:right="0" w:hanging="200" /></w:pPr></w:lvl>"#
); );
} }
} }

View File

@ -205,7 +205,7 @@ mod tests {
.build(); .build();
assert_eq!( assert_eq!(
str::from_utf8(&b).unwrap(), str::from_utf8(&b).unwrap(),
r#"<w:p><w:pPr><w:pStyle w:val="Normal" /><w:rPr /></w:pPr><w:r><w:rPr /><w:t xml:space="preserve">Hello</w:t></w:r></w:p>"# r#"<w:p><w:pPr><w:rPr /></w:pPr><w:r><w:rPr /><w:t xml:space="preserve">Hello</w:t></w:r></w:p>"#
); );
} }
@ -217,7 +217,7 @@ mod tests {
.build(); .build();
assert_eq!( assert_eq!(
str::from_utf8(&b).unwrap(), str::from_utf8(&b).unwrap(),
r#"<w:p customId="abcd-1234-567890"><w:pPr><w:pStyle w:val="Normal" /><w:rPr /></w:pPr><w:r><w:rPr /><w:t xml:space="preserve">Hello</w:t></w:r></w:p>"# r#"<w:p customId="abcd-1234-567890"><w:pPr><w:rPr /></w:pPr><w:r><w:rPr /><w:t xml:space="preserve">Hello</w:t></w:r></w:p>"#
); );
} }
@ -230,7 +230,7 @@ mod tests {
.build(); .build();
assert_eq!( assert_eq!(
str::from_utf8(&b).unwrap(), str::from_utf8(&b).unwrap(),
r#"<w:p><w:pPr><w:pStyle w:val="Normal" /><w:rPr /></w:pPr><w:bookmarkStart w:id="0" w:name="article" /><w:r><w:rPr /><w:t xml:space="preserve">Hello</w:t></w:r><w:bookmarkEnd w:id="0" /></w:p>"# r#"<w:p><w:pPr><w:rPr /></w:pPr><w:bookmarkStart w:id="0" w:name="article" /><w:r><w:rPr /><w:t xml:space="preserve">Hello</w:t></w:r><w:bookmarkEnd w:id="0" /></w:p>"#
); );
} }
@ -243,7 +243,7 @@ mod tests {
.build(); .build();
assert_eq!( assert_eq!(
str::from_utf8(&b).unwrap(), str::from_utf8(&b).unwrap(),
r#"<w:p><w:pPr><w:pStyle w:val="Normal" /><w:rPr /></w:pPr><w:commentRangeStart w:id="1" /><w:r><w:rPr /><w:t xml:space="preserve">Hello</w:t></w:r><w:r> r#"<w:p><w:pPr><w:rPr /></w:pPr><w:commentRangeStart w:id="1" /><w:r><w:rPr /><w:t xml:space="preserve">Hello</w:t></w:r><w:r>
<w:rPr /> <w:rPr />
</w:r> </w:r>
<w:commentRangeEnd w:id="1" /> <w:commentRangeEnd w:id="1" />
@ -261,7 +261,7 @@ mod tests {
.build(); .build();
assert_eq!( assert_eq!(
str::from_utf8(&b).unwrap(), str::from_utf8(&b).unwrap(),
r#"<w:p><w:pPr><w:pStyle w:val="Normal" /><w:rPr /><w:numPr><w:numId w:val="0" /><w:ilvl w:val="1" /></w:numPr></w:pPr><w:r><w:rPr /><w:t xml:space="preserve">Hello</w:t></w:r></w:p>"# r#"<w:p><w:pPr><w:rPr /><w:numPr><w:numId w:val="0" /><w:ilvl w:val="1" /></w:numPr></w:pPr><w:r><w:rPr /><w:t xml:space="preserve">Hello</w:t></w:r></w:p>"#
); );
} }
@ -271,7 +271,7 @@ mod tests {
let p = Paragraph::new().add_run(run); let p = Paragraph::new().add_run(run);
assert_eq!( assert_eq!(
serde_json::to_string(&p).unwrap(), serde_json::to_string(&p).unwrap(),
r#"{"children":[{"type":"run","data":{"runProperty":{"sz":null,"szCs":null,"color":null,"highlight":null,"underline":null,"bold":null,"boldCs":null,"italic":null,"italicCs":null,"vanish":null},"children":[{"type":"text","data":{"preserveSpace":true,"text":"Hello"}}]}}],"property":{"runProperty":{"sz":null,"szCs":null,"color":null,"highlight":null,"underline":null,"bold":null,"boldCs":null,"italic":null,"italicCs":null,"vanish":null},"style":"Normal","numberingProperty":null,"alignment":null,"indent":null},"hasNumbering":false,"attrs":[]}"# r#"{"children":[{"type":"run","data":{"runProperty":{"sz":null,"szCs":null,"color":null,"highlight":null,"underline":null,"bold":null,"boldCs":null,"italic":null,"italicCs":null,"vanish":null},"children":[{"type":"text","data":{"preserveSpace":true,"text":"Hello"}}]}}],"property":{"runProperty":{"sz":null,"szCs":null,"color":null,"highlight":null,"underline":null,"bold":null,"boldCs":null,"italic":null,"italicCs":null,"vanish":null},"style":null,"numberingProperty":null,"alignment":null,"indent":null},"hasNumbering":false,"attrs":[]}"#
); );
} }
@ -282,7 +282,7 @@ mod tests {
let p = Paragraph::new().add_insert(ins); let p = Paragraph::new().add_insert(ins);
assert_eq!( assert_eq!(
serde_json::to_string(&p).unwrap(), serde_json::to_string(&p).unwrap(),
r#"{"children":[{"type":"insert","data":{"run":{"runProperty":{"sz":null,"szCs":null,"color":null,"highlight":null,"underline":null,"bold":null,"boldCs":null,"italic":null,"italicCs":null,"vanish":null},"children":[{"type":"text","data":{"preserveSpace":true,"text":"Hello"}}]},"author":"unnamed","date":"1970-01-01T00:00:00Z"}}],"property":{"runProperty":{"sz":null,"szCs":null,"color":null,"highlight":null,"underline":null,"bold":null,"boldCs":null,"italic":null,"italicCs":null,"vanish":null},"style":"Normal","numberingProperty":null,"alignment":null,"indent":null},"hasNumbering":false,"attrs":[]}"# r#"{"children":[{"type":"insert","data":{"run":{"runProperty":{"sz":null,"szCs":null,"color":null,"highlight":null,"underline":null,"bold":null,"boldCs":null,"italic":null,"italicCs":null,"vanish":null},"children":[{"type":"text","data":{"preserveSpace":true,"text":"Hello"}}]},"author":"unnamed","date":"1970-01-01T00:00:00Z"}}],"property":{"runProperty":{"sz":null,"szCs":null,"color":null,"highlight":null,"underline":null,"bold":null,"boldCs":null,"italic":null,"italicCs":null,"vanish":null},"style":null,"numberingProperty":null,"alignment":null,"indent":null},"hasNumbering":false,"attrs":[]}"#
); );
} }
} }

View File

@ -9,7 +9,7 @@ use crate::xml_builder::*;
#[serde(rename_all = "camelCase")] #[serde(rename_all = "camelCase")]
pub struct ParagraphProperty { pub struct ParagraphProperty {
pub run_property: RunProperty, pub run_property: RunProperty,
pub style: ParagraphStyle, pub style: Option<ParagraphStyle>,
pub numbering_property: Option<NumberingProperty>, pub numbering_property: Option<NumberingProperty>,
pub alignment: Option<Justification>, pub alignment: Option<Justification>,
pub indent: Option<Indent>, pub indent: Option<Indent>,
@ -17,10 +17,9 @@ pub struct ParagraphProperty {
impl Default for ParagraphProperty { impl Default for ParagraphProperty {
fn default() -> Self { fn default() -> Self {
let s: Option<&str> = None;
ParagraphProperty { ParagraphProperty {
run_property: RunProperty::new(), run_property: RunProperty::new(),
style: ParagraphStyle::new(s), style: None,
numbering_property: None, numbering_property: None,
alignment: None, alignment: None,
indent: None, indent: None,
@ -44,7 +43,7 @@ impl ParagraphProperty {
} }
pub fn style(mut self, style_id: &str) -> Self { pub fn style(mut self, style_id: &str) -> Self {
self.style = ParagraphStyle::new(Some(style_id)); self.style = Some(ParagraphStyle::new(Some(style_id)));
self self
} }
@ -69,8 +68,8 @@ impl BuildXML for ParagraphProperty {
fn build(&self) -> Vec<u8> { fn build(&self) -> Vec<u8> {
XMLBuilder::new() XMLBuilder::new()
.open_paragraph_property() .open_paragraph_property()
.add_child(&self.style)
.add_child(&self.run_property) .add_child(&self.run_property)
.add_optional_child(&self.style)
.add_optional_child(&self.numbering_property) .add_optional_child(&self.numbering_property)
.add_optional_child(&self.alignment) .add_optional_child(&self.alignment)
.add_optional_child(&self.indent) .add_optional_child(&self.indent)
@ -93,7 +92,7 @@ mod tests {
let b = c.build(); let b = c.build();
assert_eq!( assert_eq!(
str::from_utf8(&b).unwrap(), str::from_utf8(&b).unwrap(),
r#"<w:pPr><w:pStyle w:val="Normal" /><w:rPr /></w:pPr>"# r#"<w:pPr><w:rPr /></w:pPr>"#
); );
} }
@ -103,7 +102,7 @@ mod tests {
let b = c.align(AlignmentType::Right).build(); let b = c.align(AlignmentType::Right).build();
assert_eq!( assert_eq!(
str::from_utf8(&b).unwrap(), str::from_utf8(&b).unwrap(),
r#"<w:pPr><w:pStyle w:val="Normal" /><w:rPr /><w:jc w:val="right" /></w:pPr>"# r#"<w:pPr><w:rPr /><w:jc w:val="right" /></w:pPr>"#
); );
} }
@ -113,7 +112,7 @@ mod tests {
let b = c.indent(Some(20), None, None, None).build(); let b = c.indent(Some(20), None, None, None).build();
assert_eq!( assert_eq!(
str::from_utf8(&b).unwrap(), str::from_utf8(&b).unwrap(),
r#"<w:pPr><w:pStyle w:val="Normal" /><w:rPr /><w:ind w:left="20" w:right="0" /></w:pPr>"# r#"<w:pPr><w:rPr /><w:ind w:left="20" w:right="0" /></w:pPr>"#
); );
} }
@ -123,7 +122,7 @@ mod tests {
let b = c.indent(Some(20), Some(SpecialIndentType::FirstLine(10)), None, None); let b = c.indent(Some(20), Some(SpecialIndentType::FirstLine(10)), None, None);
assert_eq!( assert_eq!(
serde_json::to_string(&b).unwrap(), serde_json::to_string(&b).unwrap(),
r#"{"runProperty":{"sz":null,"szCs":null,"color":null,"highlight":null,"underline":null,"bold":null,"boldCs":null,"italic":null,"italicCs":null,"vanish":null},"style":"Normal","numberingProperty":null,"alignment":null,"indent":{"start":20,"startChars":null,"end":null,"specialIndent":{"type":"firstLine","val":10}}}"# r#"{"runProperty":{"sz":null,"szCs":null,"color":null,"highlight":null,"underline":null,"bold":null,"boldCs":null,"italic":null,"italicCs":null,"vanish":null},"style":null,"numberingProperty":null,"alignment":null,"indent":{"start":20,"startChars":null,"end":null,"specialIndent":{"type":"firstLine","val":10}}}"#
); );
} }
} }

View File

@ -131,7 +131,7 @@ mod tests {
let b = c.build(); let b = c.build();
assert_eq!( assert_eq!(
str::from_utf8(&b).unwrap(), str::from_utf8(&b).unwrap(),
r#"<w:style w:type="paragraph" w:styleId="Heading"><w:name w:val="Heading1" /><w:rPr /><w:pPr><w:pStyle w:val="Normal" /><w:rPr /></w:pPr><w:basedOn w:val="Normal" /><w:next w:val="Normal" /><w:qFormat /></w:style>"# r#"<w:style w:type="paragraph" w:styleId="Heading"><w:name w:val="Heading1" /><w:rPr /><w:pPr><w:rPr /></w:pPr><w:basedOn w:val="Normal" /><w:next w:val="Normal" /><w:qFormat /></w:style>"#
); );
} }
} }

View File

@ -135,7 +135,7 @@ mod tests {
.build(); .build();
assert_eq!( assert_eq!(
str::from_utf8(&b).unwrap(), str::from_utf8(&b).unwrap(),
r#"<w:tc><w:tcPr /><w:p><w:pPr><w:pStyle w:val="Normal" /><w:rPr /></w:pPr><w:r><w:rPr /><w:t xml:space="preserve">Hello</w:t></w:r></w:p></w:tc>"# r#"<w:tc><w:tcPr /><w:p><w:pPr><w:rPr /></w:pPr><w:r><w:rPr /><w:t xml:space="preserve">Hello</w:t></w:r></w:p></w:tc>"#
); );
} }
@ -146,7 +146,7 @@ mod tests {
.grid_span(2); .grid_span(2);
assert_eq!( assert_eq!(
serde_json::to_string(&c).unwrap(), serde_json::to_string(&c).unwrap(),
r#"{"children":[{"type":"paragraph","data":{"children":[{"type":"run","data":{"runProperty":{"sz":null,"szCs":null,"color":null,"highlight":null,"underline":null,"bold":null,"boldCs":null,"italic":null,"italicCs":null,"vanish":null},"children":[{"type":"text","data":{"preserveSpace":true,"text":"Hello"}}]}}],"property":{"runProperty":{"sz":null,"szCs":null,"color":null,"highlight":null,"underline":null,"bold":null,"boldCs":null,"italic":null,"italicCs":null,"vanish":null},"style":"Normal","numberingProperty":null,"alignment":null,"indent":null},"hasNumbering":false,"attrs":[]}}],"property":{"width":null,"borders":null,"gridSpan":2,"verticalMerge":null,"verticalAlign":null},"hasNumbering":false}"# r#"{"children":[{"type":"paragraph","data":{"children":[{"type":"run","data":{"runProperty":{"sz":null,"szCs":null,"color":null,"highlight":null,"underline":null,"bold":null,"boldCs":null,"italic":null,"italicCs":null,"vanish":null},"children":[{"type":"text","data":{"preserveSpace":true,"text":"Hello"}}]}}],"property":{"runProperty":{"sz":null,"szCs":null,"color":null,"highlight":null,"underline":null,"bold":null,"boldCs":null,"italic":null,"italicCs":null,"vanish":null},"style":null,"numberingProperty":null,"alignment":null,"indent":null},"hasNumbering":false,"attrs":[]}}],"property":{"width":null,"borders":null,"gridSpan":2,"verticalMerge":null,"verticalAlign":null},"hasNumbering":false}"#
); );
} }
} }

View File

@ -99,7 +99,7 @@ mod tests {
.build(); .build();
assert_eq!( assert_eq!(
str::from_utf8(&b).unwrap(), str::from_utf8(&b).unwrap(),
r#"<w:txbxContent><w:p><w:pPr><w:pStyle w:val="Normal" /><w:rPr /></w:pPr></w:p></w:txbxContent>"# r#"<w:txbxContent><w:p><w:pPr><w:rPr /></w:pPr></w:p></w:txbxContent>"#
); );
} }
} }

View File

@ -59,7 +59,7 @@ mod tests {
let b = WpsTextBox::new().add_content(c).build(); let b = WpsTextBox::new().add_content(c).build();
assert_eq!( assert_eq!(
str::from_utf8(&b).unwrap(), str::from_utf8(&b).unwrap(),
r#"<wps:txbx><w:txbxContent><w:p><w:pPr><w:pStyle w:val="Normal" /><w:rPr /></w:pPr></w:p></w:txbxContent></wps:txbx>"# r#"<wps:txbx><w:txbxContent><w:p><w:pPr><w:rPr /></w:pPr></w:p></w:txbxContent></wps:txbx>"#
); );
} }
} }

View File

@ -61,7 +61,7 @@ mod tests {
let b = c.build(); let b = c.build();
assert_eq!( assert_eq!(
str::from_utf8(&b).unwrap(), str::from_utf8(&b).unwrap(),
r#"<w:styles xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" 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" mc:Ignorable="w14 w15"><w:docDefaults><w:rPrDefault><w:rPr /></w:rPrDefault></w:docDefaults><w:style w:type="paragraph" w:styleId="Normal"><w:name w:val="Normal" /><w:rPr /><w:pPr><w:pStyle w:val="Normal" /><w:rPr /></w:pPr><w:basedOn w:val="Normal" /><w:next w:val="Normal" /><w:qFormat /></w:style><w:style w:type="paragraph" w:styleId="Title"><w:name w:val="TitleName" /><w:rPr /><w:pPr><w:pStyle w:val="Normal" /><w:rPr /></w:pPr><w:basedOn w:val="Normal" /><w:next w:val="Normal" /><w:qFormat /></w:style></w:styles>"# r#"<w:styles xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" 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" mc:Ignorable="w14 w15"><w:docDefaults><w:rPrDefault><w:rPr /></w:rPrDefault></w:docDefaults><w:style w:type="paragraph" w:styleId="Normal"><w:name w:val="Normal" /><w:rPr /><w:pPr><w:rPr /></w:pPr><w:basedOn w:val="Normal" /><w:next w:val="Normal" /><w:qFormat /></w:style><w:style w:type="paragraph" w:styleId="Title"><w:name w:val="TitleName" /><w:rPr /><w:pPr><w:rPr /></w:pPr><w:basedOn w:val="Normal" /><w:next w:val="Normal" /><w:qFormat /></w:style></w:styles>"#
); );
} }
} }

View File

@ -240,7 +240,6 @@ mod tests {
LevelOverride::new(1).start(1), LevelOverride::new(1).start(1),
]; ];
let num = Numbering::new(1, 0).overrides(overrides); let num = Numbering::new(1, 0).overrides(overrides);
dbg!(&num);
nums = nums nums = nums
.add_abstract_numbering(AbstractNumbering::new(0)) .add_abstract_numbering(AbstractNumbering::new(0))
.add_numbering(num); .add_numbering(num);

View File

@ -138,14 +138,14 @@ mod tests {
</w:document>"#; </w:document>"#;
let mut parser = EventReader::new(c.as_bytes()); let mut parser = EventReader::new(c.as_bytes());
let p = Paragraph::read(&mut parser, &[]).unwrap(); let p = Paragraph::read(&mut parser, &[]).unwrap();
let s: Option<&str> = None;
assert_eq!( assert_eq!(
p, p,
Paragraph { Paragraph {
children: vec![ParagraphChild::Run(Run::new().add_text("a"))], children: vec![ParagraphChild::Run(Run::new().add_text("a"))],
property: ParagraphProperty { property: ParagraphProperty {
run_property: RunProperty::new(), run_property: RunProperty::new(),
style: ParagraphStyle::new(s), style: None,
numbering_property: None, numbering_property: None,
alignment: None, alignment: None,
indent: Some(Indent::new( indent: Some(Indent::new(
@ -177,14 +177,14 @@ mod tests {
</w:document>"#; </w:document>"#;
let mut parser = EventReader::new(c.as_bytes()); let mut parser = EventReader::new(c.as_bytes());
let p = Paragraph::read(&mut parser, &[]).unwrap(); let p = Paragraph::read(&mut parser, &[]).unwrap();
let s: Option<&str> = None;
assert_eq!( assert_eq!(
p, p,
Paragraph { Paragraph {
children: vec![ParagraphChild::Run(Run::new().add_text("a"))], children: vec![ParagraphChild::Run(Run::new().add_text("a"))],
property: ParagraphProperty { property: ParagraphProperty {
run_property: RunProperty::new(), run_property: RunProperty::new(),
style: ParagraphStyle::new(s), style: None,
numbering_property: None, numbering_property: None,
alignment: None, alignment: None,
indent: Some(Indent::new(None, None, None, Some(100))), indent: Some(Indent::new(None, None, None, Some(100))),
@ -206,14 +206,14 @@ mod tests {
</w:document>"#; </w:document>"#;
let mut parser = EventReader::new(c.as_bytes()); let mut parser = EventReader::new(c.as_bytes());
let p = Paragraph::read(&mut parser, &[]).unwrap(); let p = Paragraph::read(&mut parser, &[]).unwrap();
let s: Option<&str> = None;
assert_eq!( assert_eq!(
p, p,
Paragraph { Paragraph {
children: vec![], children: vec![],
property: ParagraphProperty { property: ParagraphProperty {
run_property: RunProperty::new(), run_property: RunProperty::new(),
style: ParagraphStyle::new(s), style: None,
numbering_property: None, numbering_property: None,
alignment: Some(Justification::new(AlignmentType::Left.to_string())), alignment: Some(Justification::new(AlignmentType::Left.to_string())),
indent: None, indent: None,
@ -238,14 +238,13 @@ mod tests {
</w:document>"#; </w:document>"#;
let mut parser = EventReader::new(c.as_bytes()); let mut parser = EventReader::new(c.as_bytes());
let p = Paragraph::read(&mut parser, &[]).unwrap(); let p = Paragraph::read(&mut parser, &[]).unwrap();
let s: Option<&str> = None;
assert_eq!( assert_eq!(
p, p,
Paragraph { Paragraph {
children: vec![], children: vec![],
property: ParagraphProperty { property: ParagraphProperty {
run_property: RunProperty::new(), run_property: RunProperty::new(),
style: ParagraphStyle::new(s), style: None,
numbering_property: Some( numbering_property: Some(
NumberingProperty::new().add_num(NumberingId::new(1), IndentLevel::new(0),) NumberingProperty::new().add_num(NumberingId::new(1), IndentLevel::new(0),)
), ),
@ -272,7 +271,6 @@ mod tests {
</w:document>"#; </w:document>"#;
let mut parser = EventReader::new(c.as_bytes()); let mut parser = EventReader::new(c.as_bytes());
let p = Paragraph::read(&mut parser, &[]).unwrap(); let p = Paragraph::read(&mut parser, &[]).unwrap();
let s: Option<&str> = None;
assert_eq!( assert_eq!(
p, p,
Paragraph { Paragraph {
@ -283,7 +281,7 @@ mod tests {
)], )],
property: ParagraphProperty { property: ParagraphProperty {
run_property: RunProperty::new(), run_property: RunProperty::new(),
style: ParagraphStyle::new(s), style: None,
numbering_property: None, numbering_property: None,
alignment: None, alignment: None,
indent: None, indent: None,
@ -308,7 +306,7 @@ mod tests {
</w:document>"#; </w:document>"#;
let mut parser = EventReader::new(c.as_bytes()); let mut parser = EventReader::new(c.as_bytes());
let p = Paragraph::read(&mut parser, &[]).unwrap(); let p = Paragraph::read(&mut parser, &[]).unwrap();
let s: Option<&str> = None;
assert_eq!( assert_eq!(
p, p,
Paragraph { Paragraph {
@ -319,7 +317,7 @@ mod tests {
)], )],
property: ParagraphProperty { property: ParagraphProperty {
run_property: RunProperty::new(), run_property: RunProperty::new(),
style: ParagraphStyle::new(s), style: None,
numbering_property: None, numbering_property: None,
alignment: None, alignment: None,
indent: None, indent: None,
@ -344,7 +342,7 @@ mod tests {
</w:document>"#; </w:document>"#;
let mut parser = EventReader::new(c.as_bytes()); let mut parser = EventReader::new(c.as_bytes());
let p = Paragraph::read(&mut parser, &[]).unwrap(); let p = Paragraph::read(&mut parser, &[]).unwrap();
let s: Option<&str> = None;
assert_eq!( assert_eq!(
p, p,
Paragraph { Paragraph {
@ -355,7 +353,7 @@ mod tests {
], ],
property: ParagraphProperty { property: ParagraphProperty {
run_property: RunProperty::new(), run_property: RunProperty::new(),
style: ParagraphStyle::new(s), style: None,
numbering_property: None, numbering_property: None,
alignment: None, alignment: None,
indent: None, indent: None,

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