diff --git a/docx-core/src/documents/elements/run.rs b/docx-core/src/documents/elements/run.rs index 523d7da..b0d13e0 100644 --- a/docx-core/src/documents/elements/run.rs +++ b/docx-core/src/documents/elements/run.rs @@ -128,7 +128,7 @@ impl Run { self } - pub fn spacing(mut self, v: u32) -> Run { + pub fn spacing(mut self, v: i32) -> Run { self.run_property = self.run_property.spacing(v); self } diff --git a/docx-core/src/documents/elements/run_property.rs b/docx-core/src/documents/elements/run_property.rs index 8521ce0..44909b0 100644 --- a/docx-core/src/documents/elements/run_property.rs +++ b/docx-core/src/documents/elements/run_property.rs @@ -17,7 +17,7 @@ pub struct RunProperty { pub italic: Option, pub italic_cs: Option, pub vanish: Option, - pub spacing: Option, + pub spacing: Option, pub fonts: Option, } @@ -32,8 +32,8 @@ impl RunProperty { self } - pub fn spacing(mut self, spacing: u32) -> RunProperty { - self.spacing = Some(spacing as u32); + pub fn spacing(mut self, spacing: i32) -> RunProperty { + self.spacing = Some(spacing); self } diff --git a/docx-core/src/reader/run_property.rs b/docx-core/src/reader/run_property.rs index f2fcc0e..4e752e1 100644 --- a/docx-core/src/reader/run_property.rs +++ b/docx-core/src/reader/run_property.rs @@ -31,7 +31,7 @@ impl ElementReader for RunProperty { XMLElement::Size => rp = rp.size(usize::from_str(&attributes[0].value)?), XMLElement::Spacing => { if let Some(v) = read_val(&attributes) { - rp = rp.spacing(u32::from_str(&v)?) + rp = rp.spacing(f32::from_str(&v)? as i32) } } XMLElement::Underline => rp = rp.underline(&attributes[0].value.clone()), diff --git a/docx-core/src/types/spacing.rs b/docx-core/src/types/spacing.rs index 1dedc5d..1b44f56 100644 --- a/docx-core/src/types/spacing.rs +++ b/docx-core/src/types/spacing.rs @@ -3,7 +3,7 @@ use serde::*; #[derive(Copy, Clone, Debug, PartialEq, Deserialize)] pub enum SpacingType { - Value(u32), + Value(i32), Line(u32), } diff --git a/docx-wasm/package.json b/docx-wasm/package.json index 2cf0cdc..7a2c7df 100644 --- a/docx-wasm/package.json +++ b/docx-wasm/package.json @@ -1,6 +1,6 @@ { "name": "docx-wasm", - "version": "0.0.113", + "version": "0.0.114", "main": "dist/node/index.js", "browser": "dist/web/index.js", "author": "bokuweb ", diff --git a/docx-wasm/src/run.rs b/docx-wasm/src/run.rs index ebf9205..b0c3d94 100644 --- a/docx-wasm/src/run.rs +++ b/docx-wasm/src/run.rs @@ -80,7 +80,7 @@ impl Run { self } - pub fn spacing(mut self, spacing: u32) -> Run { + pub fn spacing(mut self, spacing: i32) -> Run { self.0.run_property = self.0.run_property.spacing(spacing); self }