From be3e5a98605b1b6863043b7f2e8989587fd773b5 Mon Sep 17 00:00:00 2001 From: bokuweb Date: Wed, 15 Jun 2022 23:43:19 +0900 Subject: [PATCH] fix: chaespace type (#498) Co-authored-by: bokuweb --- docx-core/src/documents/elements/doc_grid.rs | 4 ++-- docx-core/src/reader/doc_grid.rs | 2 +- docx-core/src/xml_builder/elements.rs | 2 +- docx-wasm/src/doc.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docx-core/src/documents/elements/doc_grid.rs b/docx-core/src/documents/elements/doc_grid.rs index 9deedad..dd4c3e5 100644 --- a/docx-core/src/documents/elements/doc_grid.rs +++ b/docx-core/src/documents/elements/doc_grid.rs @@ -9,7 +9,7 @@ use crate::xml_builder::*; pub struct DocGrid { grid_type: DocGridType, line_pitch: Option, - char_space: Option, + char_space: Option, } impl DocGrid { @@ -35,7 +35,7 @@ impl DocGrid { self } - pub fn char_space(mut self, char_space: usize) -> Self { + pub fn char_space(mut self, char_space: isize) -> Self { self.char_space = Some(char_space); self } diff --git a/docx-core/src/reader/doc_grid.rs b/docx-core/src/reader/doc_grid.rs index 4b99c8b..7a5f735 100644 --- a/docx-core/src/reader/doc_grid.rs +++ b/docx-core/src/reader/doc_grid.rs @@ -23,7 +23,7 @@ impl ElementReader for DocGrid { doc_grid = doc_grid.line_pitch(line_pitch as usize); } else if local_name == "charSpace" { let char_space = f32::from_str(&a.value)?; - doc_grid = doc_grid.char_space(char_space as usize); + doc_grid = doc_grid.char_space(char_space as isize); } } Ok(doc_grid) diff --git a/docx-core/src/xml_builder/elements.rs b/docx-core/src/xml_builder/elements.rs index cfa87ec..5fea833 100644 --- a/docx-core/src/xml_builder/elements.rs +++ b/docx-core/src/xml_builder/elements.rs @@ -529,7 +529,7 @@ impl XMLBuilder { mut self, t: &DocGridType, line_pitch: Option, - char_space: Option, + char_space: Option, ) -> Self { let t = t.to_string(); let line_pitch_string = format!("{}", line_pitch.unwrap_or_default()); diff --git a/docx-wasm/src/doc.rs b/docx-wasm/src/doc.rs index 0a9fadc..56dd020 100644 --- a/docx-wasm/src/doc.rs +++ b/docx-wasm/src/doc.rs @@ -162,7 +162,7 @@ impl Docx { mut self, grid_type: docx_rs::DocGridType, line_pitch: Option, - char_space: Option, + char_space: Option, ) -> Self { let mut doc_grid = docx_rs::DocGrid::with_empty().grid_type(grid_type); if let Some(line_pitch) = line_pitch {