Fix spacing (#184)

* fix spacing

* fix: spacing
main
bokuweb 2020-10-20 18:22:12 +09:00 committed by GitHub
parent 2f1cd0d127
commit 7a13d159d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 8 additions and 8 deletions

View File

@ -128,7 +128,7 @@ impl Run {
self 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.run_property = self.run_property.spacing(v);
self self
} }

View File

@ -17,7 +17,7 @@ pub struct RunProperty {
pub italic: Option<Italic>, pub italic: Option<Italic>,
pub italic_cs: Option<ItalicCs>, pub italic_cs: Option<ItalicCs>,
pub vanish: Option<Vanish>, pub vanish: Option<Vanish>,
pub spacing: Option<u32>, pub spacing: Option<i32>,
pub fonts: Option<RunFonts>, pub fonts: Option<RunFonts>,
} }
@ -32,8 +32,8 @@ impl RunProperty {
self self
} }
pub fn spacing(mut self, spacing: u32) -> RunProperty { pub fn spacing(mut self, spacing: i32) -> RunProperty {
self.spacing = Some(spacing as u32); self.spacing = Some(spacing);
self self
} }

View File

@ -31,7 +31,7 @@ impl ElementReader for RunProperty {
XMLElement::Size => rp = rp.size(usize::from_str(&attributes[0].value)?), XMLElement::Size => rp = rp.size(usize::from_str(&attributes[0].value)?),
XMLElement::Spacing => { XMLElement::Spacing => {
if let Some(v) = read_val(&attributes) { 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()), XMLElement::Underline => rp = rp.underline(&attributes[0].value.clone()),

View File

@ -3,7 +3,7 @@ use serde::*;
#[derive(Copy, Clone, Debug, PartialEq, Deserialize)] #[derive(Copy, Clone, Debug, PartialEq, Deserialize)]
pub enum SpacingType { pub enum SpacingType {
Value(u32), Value(i32),
Line(u32), Line(u32),
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "docx-wasm", "name": "docx-wasm",
"version": "0.0.113", "version": "0.0.114",
"main": "dist/node/index.js", "main": "dist/node/index.js",
"browser": "dist/web/index.js", "browser": "dist/web/index.js",
"author": "bokuweb <bokuweb12@gmail.com>", "author": "bokuweb <bokuweb12@gmail.com>",

View File

@ -80,7 +80,7 @@ impl Run {
self 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.0.run_property = self.0.run_property.spacing(spacing);
self self
} }